我在Nginx.conf中为我的域名设置了hsts。它将重定向我的网站到https的主端口80。但我不想在我的另一个港口发生重定向。我该怎么做?
发布于 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
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.https://serverfault.com/questions/1056800
复制相似问题