在nginx配置里面添加add_header如下:
add_header 'Access-Control-Allow-Origin' '*';
#add_header 'Access-Control-Allow-Origin' 'http://localhost:8080' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type, Authorization' always;