location / {
root D:/webroot/online_xinshop/public;
index index.html index.php;
autoindex_exact_size off;
autoindex_localtime on;
#add_header Access-Control-Allow-Origin *;
#add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
#add_header Access-Control-Allow-Headers Token,Authorization;
if ($request_method = OPTIONS ) {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers Token,Origin,X-Requested-With,Content-Type,Accept;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header Access-Control-Allow-Headers Token,Authorization;
return 200;
}
}
#对目录设置跨域
location /upload {
root D:/webroot/online_xinshop/public;
add_header Access-Control-Allow-Origin *;
# add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
# add_header Cache-Control no-cache;
if ($request_method = OPTIONS ) {
return 200;
}
}