可以application 处理 也可以在nginx 上处理
nginx
server {
listen 80;
server_name localhost;
location / {
add_header Access-Control-Allow-Origin 'http://localhost:8080' always;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Allow-Methods '*';
add_header Access-Control-Allow-Credentials 'true';
if ($request_method = 'OPTIONS') {
return 204;
}
proxy_pass http://localhost:9000;
}
}
标签:Control,跨域,header,处理,Access,nginx,add,Allow
From: https://www.cnblogs.com/guanchaoguo/p/17465186.html