码迷,mamicode.com
首页 > 其他好文 > 详细

nginx反向代理和跨域

时间:2017-12-18 15:11:34      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:markdown   lis   include   跨域   blog   post   clu   ken   error   

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反向代理和跨域

标签:markdown   lis   include   跨域   blog   post   clu   ken   error   

原文地址:http://www.cnblogs.com/restful/p/7813203.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!