突然間,似乎沒有更改我的web應用中的任何內容,我開始出現CORS錯誤當在Chrome中打開它。我試着添加一個Access-Control-Allow-Origin: *
標題。然後,我得到這個錯誤:Access-Control-Allow-Origin:證書標誌爲true時不允許使用「*」,但沒有Access-Control-Allow-Credentials標頭
XMLHttpRequest cannot load http://localhost:9091/sockjs-node/info?t= 1449187563637. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:3010' is therefore not allowed access.
但你可以在下面的圖片中看到,有沒有Access-Control-Allow-Credentials
頭。
跆拳道? Chrome bug?
我的頁面加載在http://localhost:3010
,該服務器也使用Access-Control-Allow-Origin: *
沒有問題。如果兩個端點都使用它,是否有問題?
是當使用參數withCredentials:true進行AJAX調用時,響應頭應具有Access-Control-Allow-Credentials = true。因此,此標頭不允許使用Access-Control-Allow-Origin = * 有關更多信息,請在withCredential參數和響應標頭中查看本文: http://www.ozkary.com /2015/12/api-oauth-token-access-control-allow-credentials.html – ozkary
與此相同,認爲錯誤消息是指頭部。沒有意識到'withCredentials'標誌。奇怪的。 – BastiBen
我提出了一個關於消息混亂的鉻錯誤,如果我沒有記錯的話,他們會認真對待它 – Andy