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