Nginx/CORS/HTTP-proxy are common front-end processing cross-domain methods

  1. Jsonp inserts a script tag in the page and adds cb function in the address bar. After receiving the request, the back end returns cb(the data that the back end returns to the front end). Disadvantages: Only supports GET
  2. Cors back-end configuration permission control allows sources to be written to front-end sources
  3. PostMessage Two pages can access iframes. One sends a postMessage and the other receives an onMessage. The postMessage first sends data, and the second sends the source to which it is to be sent
  4. Document. domain Secondary domain name communication, subdomain parent domain iframe, parent domain set domain to the same
  5. Window. name is an empty string, iframe, that requires two homologous pages (A/B) and a page (c) from a different source. A references C, c places the data in window.name, changes the reference from C to B, and a/ B is accessible from the same source
  6. Location. hash iframe Requires two same-origin pages (A and B) and a different source page (C). A sends the hash to C. C receives the hash data and sends it to B. B searches for A to modify the hash of A and carries the data sent by C
  7. The HTTP proxy middleware
  8. Nginx, configure header, permission control allows source, write front-end source
  9. Websocket does not exist across domains. The client uses WebSocket to create WS objects, onOpen, send to send data, and onMessage to receive data. The Node can use WS packages to create WSS objects. On (‘connection’) listens for connections, on(‘message’) gets data, and send sends data