Ajax-21: Set CORS response header to achieve cross-domain

What is CORS?

CORS (Cross-domain Resource Sharing) is the official cross-domain solution. Its characteristic is that it does not require any special operations on the client side. It is processed entirely in the server and supports GET and POST requests. The cross-domain resource sharing standard has added a new set of HTTP header fields, allowing the server to declare which source sites have permission to access which resources through the browser.

Set the corresponding headers that allow cross-domain

response.setHeader('Access-Control-Allow-Origin', '*')

Guess you like

Origin blog.csdn.net/sinat_41696687/article/details/114789316