location /stmApi/ {
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET,PUT,POST,DELETE,OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,web-token,app-token,Authorization,Accept,Origin,Keep-Alive,User-Agent,X-Mx-ReqToken,X-Data-Type,X-Auth-Token,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,token,sign,timestamp';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Conten
nginx配置跨域
最新推荐文章于 2024-08-30 14:29:09 发布
本文详细介绍了如何在Nginx服务器上配置跨域策略,以解决前端开发中遇到的跨域问题。通过设置合理的超时时间和配置HTTP响应头,确保了前后端交互的顺畅进行。
摘要由CSDN通过智能技术生成