TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Why Web Browsers REST client extensions doesn't have CORS policy erros?

2 点作者 calebjosue超过 6 年前
Why Web browsers REST client extensions or curl command don't have CORS policy error? And when trying JavaScript on local file you experiment this sort of error? It is mandatory to run the file from a local web server? Thanks!

1 comment

jhjhds超过 6 年前
CORS only apply to browsers<p><a href="http:&#x2F;&#x2F;performantcode.com&#x2F;web&#x2F;do-you-really-know-cors" rel="nofollow">http:&#x2F;&#x2F;performantcode.com&#x2F;web&#x2F;do-you-really-know-cors</a><p>Common Misconception About CORS At the first glance, CORS configuration on a server side looks like some sort of ACL (Access Control List) – a server returns the origin that it accepts requests from. The only way to access a resource is to send a request from the origin whitelisted by a server, right? Not really. Remember that HTTP isn’t used only by browsers and you can send an HTTP request from any client like curl, Postman, and so on. If you prepare a custom HTTP request in those tools, you can put any Origin header you want. You can also skip it and a server usually returns a correct result anyway. Why is that? Because as I mentioned earlier, Same-Origin Policy is a concept implemented in browsers. Other tools or software components don’t care about it that much.
评论 #19112331 未加载