2017-09-08 82 views
0

我得到間歇性我的環回API服務器上的CORS錯誤存在於Google App Engine上。隨機獲取CORS錯誤

我想確定錯誤在哪裏,但到目前爲止我很不走運。

有沒有人遇到過這個?

對於客戶端,我採用了棱角分明2.

錯誤:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '(MY-SITE-URL)' is therefore not allowed access. The response had HTTP status code 502.

+3

如果您收到502錯誤,那麼服務器可能沒有設置您的頭文件,因爲它已經崩潰。你需要找出造成502的原因。 – Octopus

回答

0

新的環系統從midelware.json方式隔開CORS。

您在該文件中使用了CORS選項嗎?

middleware.development.json

"initial": { 
"compression": { 
}, 
"cors": { 
    "params": { 
    "origin": true, 
    "credentials": true, 
    "maxAge": 86400 
    } 
} 

} 

可能是這應該爲你工作。