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

NGINX头

时间:2020-01-27 13:51:00      阅读:58      评论:0      收藏:0      [点我收藏+]

标签:eth   更改   http   utf-8   json   prot   user   add   custom   

location / {
   
   #处理浏览器OPTIONS 预请求,默认返回200
   if ($request_method = ‘OPTIONS‘) {
    add_header ‘Access-Control-Allow-Credentials‘ true;
    add_header ‘Access-Control-Allow-Origin‘ "$http_origin";
    add_header ‘Access-Control-Allow-Methods‘ ‘GET, POST, OPTIONS‘;
    add_header ‘Access-Control-Allow-Headers‘ ‘DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range‘;
    add_header ‘Access-Control-Max-Age‘ 1728000;
    add_header ‘Content-Type‘ ‘application/json; charset=utf-8‘;
    add_header ‘Content-Length‘ 0;
    return 200;
   }
   
   proxy_pass http://tomcat ;
   #tomcat支持https 请求,须tomcat 更改相关配置
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
   proxy_set_header Host $http_host; 
   proxy_set_header X-Forwarded-Proto https; 
   proxy_redirect off; 
  
  
        }



NGINX头

标签:eth   更改   http   utf-8   json   prot   user   add   custom   

原文地址:https://www.cnblogs.com/leigepython/p/12235655.html

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