location ^~ /api/ {
add_header 'Access-Control-Allow-Origin' '*';
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
if ($request_method = 'OPTIONS') {
return 204;
}
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8003;
}
nginx跨域配置
最新推荐文章于 2023-04-11 14:09:20 发布