原因:在 CORS 標頭 'Access-Control-Allow-Credentials' 中應為 'true'
原因
Reason: expected 'true' in CORS header 'Access-Control-Allow-Credentials'
哪裡出錯了?
CORS 請求要求伺服器允許使用憑據,但伺服器的 Access-Control-Allow-Credentials 頭的值未設定為 true 以啟用憑據的使用。
若要解決客戶端上的此問題,請修改程式碼以不請求使用憑據。
- 如果使用 Fetch API,請確保
Request.credentials為"omit"。 - 如果使用
XMLHttpRequest發出請求,請確保您未將withCredentials設定為true。 - 如果使用 伺服器傳送事件,請確保
EventSource.withCredentials為false(這是預設值)。
若要透過更改伺服器配置來消除此錯誤,請調整伺服器配置,將 Access-Control-Allow-Credentials 頭的值設定為 true。