简体   繁体   English

Gophish API 请求被阻止:“不允许标头‘授权’”(Javascript 请求)

[英]Gophish API request is blocked : "header ‘authorization’ is not allowed" (Javascript request)

I am using the Gophish API for the first time.我是第一次使用 Gophish API。

I can't get the list of the sending profiles through a simple Javascript HTTP request.我无法通过简单的 Javascript HTTP 请求获取发送配置文件列表。 Firefox display this error message: 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).

Here is my request code:这是我的请求代码:

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))
}

What could I try?我可以尝试什么? Is there a way to edit Gophish CORS policy?有没有办法编辑 Gophish CORS 政策?

Thanks.谢谢。

Julien于连

Additional information:附加信息:

  • The campaigns made from Gophish browser interface work well.从 Gophish 浏览器界面制作的活动效果很好。
  • If I try the same request with POSTMAN, it works only if I disable the SSL certificate verification.如果我用 POSTMAN 尝试相同的请求,它只有在我禁用 SSL 证书验证时才有效。
  • The SSL certificate is valid (I own it and it is announced as valid by browsers) SSL 证书有效(我拥有它并被浏览器宣布为有效)

I actually discovered that it requires to disable the SSL certificate verification as the SSL certificate is known and valid.我实际上发现它需要禁用 SSL 证书验证,因为 SSL 证书是已知且有效的。

I am gonna open a new ticket for that purpose as it is bugging as well... xD !我要为此目的开一张新票,因为它也有窃听……xD!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel API,请求标题字段在飞行前响应中不允许Access-Control-Allow-Headers进行授权 - Laravel API, Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response undici 节点使用 header 发出 api 请求以获得授权 - undici node make api request with header for Authorization PHP cURL 向 API 发送授权 header 字段的 POST 请求 - PHP cURL send a POST request with authorization header field to an API 如何生成授权请求头? - How to generate authorization request header? 错误:不允许执行您请求的操作。 我的API在CodeIgniter中HTTP请求方式为“POST”时被过滤器拦截 4 - Error: The action you requested is not allowed. My API is blocked by filters when the HTTP request method is "POST" in CodeIgniter 4 在 Ruby 中使用 RestClient::Request 授权标头获取 api 请求的 401 错误 - Getting 401 error on api request using RestClient::Request authorization header in Ruby 难以设置 API 授权请求 - Difficult to setup an API Authorization request Laravel API标头请求 - Laravel api header request 是否可以在 HTTP 请求上使授权标头可选? - Is it possible to make the authorization header optional on an HTTP request? 使用 Java 为每个 API 调用请求同时发送具有不同授权标头的多个 API 请求 - Send multiple API requests simultaneously with different authorization header for each API Call request using Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM