可以在nginx完成配置,允许多个域名跨域请求该服务端口
location / {
#为预检请求加的methods
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE';
#为预检请求加的header
add_header 'Access-Control-Allow-Headers' '*';
#多个域名英文逗号分隔
add_header 'Access-Control-Allow-Origin' 'http://localhost:8080';
}