Nginx 配置 CORS 跨域


Nginx 配置 CORS 跨域

1
2
3
location / {
add_header 'Access-Control-Allow-Origin' 'http://localhost:7456';
}

注意:如果在nodejs或java开发的服务中,有启用CORS,则在Nginx代理中去掉CORS,否则会双重设置,导致报错:

1
The 'Access-Control-Allow-Origin' header contains multiple values '*, *',but only one is allowed.