我在GAE上有很多針對Python的應用程序,還有一些基於AngularJS。其他人工作正常,而AngularJS則用於正常工作。現在,我得到以下錯誤:GAE中的AngularJS應用程序獲取CORS錯誤
XMLHttpRequest cannot load xxxxxxxxx/rest/loadlocale?locale=en. Redirect from 'xxxxxxxxxxxxx/rest/loadlocale?locale=en' to ' https://www.google.com/accounts/ServiceLogin?service=ah&passive=true& ...... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'xxxxxxxx' is therefore not allowed access.
如果我去ServiceLogin明確從Chrome中,該應用程序將工作確定了一會兒。過了一段時間(我假設登錄到期時)錯誤再次出現。
app.yaml中具有以下部分:
- url: /rest/.*
script: main.APP
login: required
secure: always
但刪除 「secure: always
」 沒什麼區別。
該錯誤發生在第一個客戶端http請求,但請求處理程序的Python服務器代碼顯示沒有被訪問過的標誌爲 。
對不起,沒有這樣做。同樣的錯誤。我注意到其他可以正常工作的應用程序有時也有302(重定向)響應代碼。所以其他事情正在發生。難道這是因爲它起源於XXXX.appspot.com/rest而不是XXXX.appspot.com,它會觸發CORS錯誤? –