[英]Laravel API, Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response
[英]Gophish API request is blocked : "header ‘authorization’ is not allowed" (Javascript request)
我是第一次使用 Gophish API。
我無法通過簡單的 Javascript HTTP 請求獲取發送配置文件列表。 Firefox 顯示此錯誤消息:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at
``https://MY_GOPHISH_SERVER_URL:3333/api/smtp``. (Reason: header ‘authorization’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response).
這是我的請求代碼:
fetch("MY_GOPHISH_SERVER_URL:3333/api/smtp", {
method: "GET",
headers: {
Authorization : MY_GOPHISH_API_KEY
},
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error.message))
}
我可以嘗試什么? 有沒有辦法編輯 Gophish CORS 政策?
謝謝。
於連
附加信息:
我實際上發現它需要禁用 SSL 證書驗證,因為 SSL 證書是已知且有效的。
我要為此目的開一張新票,因為它也有竊聽……xD!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.