码迷,mamicode.com
首页 > 其他好文 > 详细

nginx 跨域解决

时间:2018-08-10 21:15:28      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:max-age   files   bsp   pac   解决   delete   nginx 跨域   uri   min   

server {

  listen 8811 default_server;

 

   root /opt/bp;

 

   # Make site accessible from http://localhost/

   server_name localhost;

 

   location / {

     if ( $request_method = OPTIONS ) { add_header Access-Control-Allow-Origin "$http_origin";add_header Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, DELETE";add_header Access-Control-Max-Age "3600";add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization";add_header Access-Control-Allow-Credentials "true";add_header Content-Length 0;add_header Content-Type text/plain;return 200;} 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‘ ‘Content-Type,*‘;try_files $uri $uri/ =404;autoindex on;}

}

nginx 跨域解决

标签:max-age   files   bsp   pac   解决   delete   nginx 跨域   uri   min   

原文地址:https://www.cnblogs.com/sea-stream/p/9457014.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!