首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我不想要8001端口的HSTS,而是其他端口

问我不想要8001端口的HSTS,而是其他端口
EN

Server Fault用户
提问于 2021-03-12 06:27:52
回答 1查看 332关注 0票数 0

我在Nginx.conf中为我的域名设置了hsts。它将重定向我的网站到https的主端口80。但我不想在我的另一个港口发生重定向。我该怎么做?

EN

回答 1

Server Fault用户

发布于 2021-03-12 06:50:57

简化: HSTS是一个域范围的策略,禁止在您的域上使用普通http。无论您想要通过普通http访问哪个端口,无论是默认端口80还是类似于8001的其他端口,该策略都是如此。

如果您请求您的域名

通过将uri重写为http://www.example.com来实现的

https://www.example.com

在端口80以外的其他端口上,将普通http请求重写为https,但维护非标准端口时,

应该将http://www.example.com:8001/page.html重写为

https://www.example.com:8001/page.html

因此,只要您将端口8001配置为支持TLS,就可以了。

https://www.rfc-editor.org/rfc/rfc6797

代码语言:javascript
复制
      The UA MUST replace the URI scheme with "https" [RFC2818], and

      if the URI contains an explicit port component of "80", then
      the UA MUST convert the port component to be "443", or

      if the URI contains an explicit port component that is not
      equal to "80", the port component value MUST be preserved;
      otherwise,

      if the URI does not contain an explicit port component, the UA
      MUST NOT add one.

      NOTE:  These steps ensure that the HSTS Policy applies to HTTP
             over any TCP port of an HSTS Host.
票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1056800

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档