我这边用的nginx的
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Allow-Origin $http_origin always;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,PATCH,OPTIONS;
add_header Access-Control-Allow-Headers * always;
add_header Access-Control-Allow-Headers DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,Accept;
add_header Access-Control-Max-Age 1728000;
add_header Content-Length 0;
location / {
if ($request_method = 'OPTIONS') {
return 200;
}
}