nginx跨域部分问题

nginx 跨域支持多域名

 

 

map $http_origin $corsHost {
    default 0;
    "~http://www.123admin.com" http://www.123admin.com;
    "~http://m.123admin.com" http://m.123admin.com;
    "~http://wap.123admin.com" http://wap.123admin.com;
}
server
{
    listen 80;
    server_name search.123admin.com;
    root /nginx;
    location /
    {
        add_header Access-Control-Allow-Origin $corsHost;
    }
}

 

 

Access-Control-Allow-Methods: POST, GET, OPTIONS

Access-Control-Allow-Origin: *

Access-Control-Allow-Credentials: true

Access-Control-Allow-Headers: content-type,xfilecategory,xfilename,xfilesize

上一篇:Nginx https转http 微信内部浏览器报跨域问题


下一篇:如何极速极速搭建个人博客?Copy攻城狮用的这一招很优秀!