nginx反向代理和跨域
阿新 • • 發佈:2017-12-18
pro let lis cati req options allow type include
server
{
listen 80;
#listen [::]:80;
server_name weather.xxx.com ;
index index.html index.htm index.php default.html default.htm default.php;
include none.conf; #error_page 404 /404.html; location / { add_header 'Access-Control-Allow-Origin' "*"; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH, DELETE'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Headers' 'x-access-token,content-type,token,x-request-id'; proxy_pass http://xx.cn; proxy_set_header "Referer" "http://xx.cn"; } location ~ /\. { deny all; } access_log off; }
nginx反向代理和跨域