Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决跨域的方法以及原理 #243

Open
smileyby opened this issue Jun 25, 2022 · 0 comments
Open

解决跨域的方法以及原理 #243

smileyby opened this issue Jun 25, 2022 · 0 comments
Labels

Comments

@smileyby
Copy link
Owner

前端:JSONP、websocket、postmessage、proxy
后端:CORS

proxy代理原理:同源策略是浏览器端的限制,服务器之间是没有这个限制的。所以通过在客户端和服务器中间,额外创建一个服务来转发请求的方式是可以实现跨域的

CORS:浏览器的策略,跨源资源共享 (CORS)(或通俗地译为跨域资源共享)是一种基于 HTTP 头的机制,该机制通过允许服务器标示除了它自己以外的其它 origin(域,协议和端口),使得浏览器允许这些 origin 访问加载自己的资源。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant