我運行一個 WordPress 網站,最近使用 CloudFront 配置了 CDN。
大多數功能都工作正常,但我從 Github 加載的 JS 檔案遇到了 CORS 問題。
我嘗試了很多方法來解決這個問題,但仍然出現以下錯誤。
Ensure CORS response header values are valid
A cross-origin resource sharing (CORS) request was blocked because of invalid or missing response headers of the request or the associated preflight request .
To fix this issue, ensure the response to the CORS request and/or the associated preflight request are not missing headers and use valid header values.
Note that if an opaque response is sufficient, the request's mode can be set to no-cors to fetch the resource with CORS disabled; that way CORS headers are not required but the response content is inaccessible (opaque).
這是我在 Cloudfront 上的設定 ->https://imgsh.net/a/5GFcr4m.jpg
Access-Control-Allow-Credentials
false
Access-Control-Allow-Headers
Access-Control-Allow-Methods
GET
HEAD
PUT
POST
PATCH
DELETE
OPTIONS
Access-Control-Allow-Origin
*
Access-Control-Expose-Headers
*
Access-Control-Max-Age (seconds)
有人可以建議我如何解決這個問題嗎?