当前位置:论坛首页 > Linux面板 > 求助

【处理中】安装免费SSL证书会删除配置中所有add_header

发表在 Linux面板2018-7-8 20:34 [复制链接] 1 2361

为什么我在申请了免费Let's Encrypt之后配置文件里面的add_header语句全部被删?
HSTS时间头:

  1. add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
复制代码
跨域头:
  1.     location ~* \.(eot|otf|ttf|woff|woff2|css|js)$
  2.     {
  3.         if ($request_method = 'OPTIONS')
  4.         {
  5.             add_header 'Access-Control-Allow-Origin' '*';
  6.             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  7.             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';
  8.             add_header 'Access-Control-Max-Age' 1728000;
  9.             add_header 'Content-Type' 'text/plain; charset=utf-8';
  10.             add_header 'Content-Length' 0;
  11.             return 204;
  12.         }
  13.         if ($request_method = 'POST')
  14.         {
  15.             add_header 'Access-Control-Allow-Origin' '*';
  16.             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  17.             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';
  18.             add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
  19.         }
  20.         if ($request_method = 'GET')
  21.         {
  22.             add_header 'Access-Control-Allow-Origin' '*';
  23.             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  24.             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';
  25.             add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
  26.         }
  27.     }
复制代码

第一段直接消失,第二段只剩下return。

要是这样是不是每三个月都要手动添加这两段语句?

望大神解释并修复一下。

PS:如果能在申请SSL之后自动添加这两段语句就好了。

使用道具 举报 只看该作者 回复
发表于 2018-7-9 11:44:53 | 显示全部楼层
确实有此问题 正在处理 感谢反馈
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术分析

工作时间:09:00至18:30

快速回复 返回顶部 返回列表