在主端口80上,不在其他端口上

我在站点http://server.mydom.tld:80上为我的域设置了hsts,因此浏览器在端口443上访问端口https://server.mydom.tld

不过,我也有其他的networking服务器,在其他端口上运行。 所以,当我去http://server.mydom.tld:8888它被转发到https://server.mydom.tld:8888 ,但该服务器不运行HTTPS,所以请求失败。

那是根据规格?

我注意到我不在http://mydom.tld或http://www.mydom.tld上运行hsts,这可能是一个错误。

该怎么办?

是的,这是故意的。 RFC 6797指出:

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. 

您应该在不同的域上运行纯HTTP服务,或者甚至更好地使用HTTP + TLS服务器作为内部普通HTTP服务的反向代理。