跨域及其解决方案
一、何为跨域
1、同源策略
在谈跨域之前,首先来说说同源策略吧;同源策略是浏览器的一种基本的安全功能,其中的源指的就是协议名+域名+端口号,也即只有这三者都相同才是同源的,否则就属于不同源,比如说下面的几个请求:
1. http://www.abc.com:8080
2. https://ww.abc.com:8080
3. http://www.abcd.com:8080
4. http://www.abc.com:8081
5. http://www.abc.com:8080/sds
请求2,3,4和请
原创
2021-08-24 22:46:45 ·
151 阅读 ·
0 评论