Home  >  Article  >  Backend Development  >  Configuring cross-domain support function in nginx

Configuring cross-domain support function in nginx

WBOY
WBOYOriginal
2016-07-29 08:55:281116browse

Configure
http {
...
in nginx.conf add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow- Methods GET, POST, OPTIONS;
...
}
This way you can support cross-domain requests for GET, POST, OPTIONS

You can also add_header Access-Control-Allow-Origin http://test. 51testing.com; --Specify the allowed URL;

Reprint address: http://www.51testing.com/html/96/215196-829360.html

The above introduces the configuration of cross-domain support function in nginx, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn