注意 localhost 后面的 /
不能省略
proxy_pass 请求到需要跨域的服务器即可
# Avoid CORS and reverse proxy settings
location /spweb/ {
proxy_http_version 1.1;
proxy_pass https://xx/;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS";
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept";
add_header Access-Control-Allow-Credentials true;
}