服务器 Gind.cn

服务器问题集锦,包括 Linux(Ubuntu, Centos,Debian等)和Windows Server服务器

当HSTS处于活动状态时,使用CNAMEloggingredirect到HTTPS

我们有一个在HTTPS上运行的网站,url是:abc.example.com。 问题是,我们的客户认为,任何网站的URL应该从www开始,并打印所有标签www.abc.example.com … 没问题,我只是使用IIS的URL重写function创build了一个redirect规则,将所有主机名redirect到https://abc.example.com 。 到现在为止还挺好。 几个月前,我们收到了来自IS部门的电子邮件,指出abc.example.com缺lessStrict-Transport-Security标头。 他们要求我们实施以下标题: Strict-Transport-Security = max-age=31536000; includeSubDomains; preload. 那时候我并没有完全意识到这个标题的确切function,所以我一味的把它添加到网站上。 我testing了网站,我从来没有使用www.abc.example.com进行testing。 我只是刚刚发现,这个HSTS头将自己redirect所有HTTP URL到HTTPS URL,导致忽略我的自定义redirect规则。 现在的问题是,用户inputhttp://www.abc.example.com并redirect到https://www.abc.example.com而不是https://abc.example.com ,导致SSL证书错误,因为www.abc.example.com没有SSL证书。 只要includeSubDomains处于活动状态,我似乎无法防止在Web服务器上发生这种情况,除非我专门为www.abc.example.com设置了SSL证书。 这就是为什么我想通过使用CNAMElogging在DNS级别redirect来解决这个问题: www.abc.example.com. CNAME abc.example.com. www.abc.example.com. CNAME abc.example.com. 我的问题是,这会工作吗? 当用户inputhttp://www.abc.example.com ,CNAMElogging将首先将此URLredirect到http://abc.example.com ,然后使用以下命令成功redirect到https://abc.example.com HSTS头? 或者即使在DNS级别,参数preload也会阻止这种情况的发生? 任何build议或帮助表示赞赏。