Configuring cross-domain support function in nginx

WBOY
Release: 2016-07-29 08:55:28
Original
1115 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template