简体   繁体   English

没有响应标头时允许CORS Access-Control-Allow-Origin

[英]CORS allowed when no response header Access-Control-Allow-Origin

I'm able to send post/put/delete to my localhost even though the response headers doesn't include "Access-Control-Allow-Origin" , I'm using chrome so my question: 我可以将post / put / delete发送到我的本地主机,即使响应头不包含“ Access-Control-Allow-Origin”,我也在使用chrome,所以我的问题是:

1- will requests from different site allowed if no "Access-Control-Allow-Origin" returned ? 1-如果没有返回“ Access-Control-Allow-Origin”,是否允许来自其他站点的请求?

2- why the request worked on my local host , the browser sent the following headers in request : 2-为什么请求在我的本地主机上有效,浏览器在请求中发送了以下标头:

Origin: http://localhost:8080 来源: http:// localhost:8080

or the browsers ignore the response header "Access-Control-Allow-Origin" when it's the same origin ? 还是浏览器忽略源相同的响应标头“ Access-Control-Allow-Origin”?

will requests from different site allowed if no "Access-Control-Allow-Origin" returned ? 如果未返回“ Access-Control-Allow-Origin”,是否允许来自其他站点的请求?

A POST request, all else being equal, will be allowed, but the Same Origin Policy will prevent JS from reading the response. 在所有其他条件相同的情况下,将允许POST请求,但Same Origin Policy将阻止JS读取响应。

PUT and DELETE requests require a Preflight request to receive permission from CORS first, so the requests will be blocked. PUT和DELETE请求需要一个Preflight请求才能首先从CORS接收许可,因此将阻止该请求。

why the request worked on my local host 为什么请求在我的本地主机上起作用

The Same Origin Policy doesn't block access when the request is from the same origin. 当请求来自相同来源时,“相同来源策略”不会阻止访问。

暂无
暂无

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

相关问题 Cors header “访问控制允许来源”被阻止 Api 响应 - Cors header “Access-control-allow-origin” blocked Api Response “请求 header 字段 Access-Control-Allow-Origin 在预检响应中被 Access-Control-Allow-Headers 不允许”尽管 CORS 配置有效 - “Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers in preflight response” despite valid CORS config 当凭证包括 - CORS policy Access-Control-Allow-Origin header in the response mustn't be wildcard * when credentials include CORS 策略错误:“Access-Control-Allow-Origin”标头包含多个值“*”、“*”,但只允许一个 - CORS policy error: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed header("访问控制允许来源:"); 不工作 CORS 策略,预检请求不允许重定向 - header("Access-Control-Allow-Origin: "); dont work CORS policy, Redirect is not allowed for a preflight request CORS BLOCKED 'Access-Control-Allow-Origin' Firebase 功能不允许 - CORS BLOCKED 'Access-Control-Allow-Origin' Firebase Functions not allowed CORS标头“ Access-Control-Allow-Origin”丢失,但它出现在标头中 - CORS header 'Access-Control-Allow-Origin' missing but it present in the header 缺少CORS标头'Access-Control-Allow-Origin' - The CORS Header 'Access-Control-Allow-Origin' is missing (原因:CORS标头“ Access-Control-Allow-Origin”缺失) - (Reason: CORS header ‘Access-Control-Allow-Origin’ missing) CORS 错误:对预检请求的响应 'Access-Control-Allow-Origin' header 包含多个值 '*、*'、 - CORS error: Response to preflight request The 'Access-Control-Allow-Origin' header contains multiple values '*, *',
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM