Ajax cross-domain problem, when we passed another domain ajax request on a website api time, this time will meet Error: No 'AcceControl-Allow-Origin' headerss- is present on the requested resource.
When our server is nginx, add the following code to the Nginx configuration file which:
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
Nginx restart to take effect.
Be the First to comment.