nginx 解决跨域问题
conf配置文件
location /api/{
rewrite ^(api/?.*)$ /$1 break;
proxy_pass "http://localhost:8881";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers Content-Type;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header Access-Control-Allow-Credentials true;
}
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »