Cross-domain (non-same-origin policy request)

  • The same-origin policy requests Ajax/FETCH
  • Cross domain transfer

1. Some tags have cross-domain support. Such as

2. Split the server

  • Web server: static resource kbs.sports.qq.com
  • Data server: business logic and data analysis api.sports.qq.com
  • Picture server
  1. If they’re all the same, they’re homologous, and if they’re different, they’re cross-domain
  • agreement

  • The domain name

Urls always have slant bars. But there is no domain name. The domain name between // and the first /.Copy the code
  • The port number

The web server address: http://127.0.0.1:3000/index.html

Data interface address: http://127.0.0.1:4000/list

1. JSONP

  • script
  • img
  • link
  • iframe
  • .

=> No cross-domain request restriction exists

Problem: JSONP can only handle GET requests, and security is not particularly good