【发布时间】:2021-09-09 21:23:24
【问题描述】:
我已经建立了这个网站:
http://website1.com/ - 返回301 Moved Permanently 并重定向到http://www.website1.com/。
http://www.website1.com/ - 返回301 Moved Permanently 并重定向到https://www.website2.com/。
https://www.website2.com/ - 返回200 OK 并在响应中包含:
strict-transport-security: max-age=31536000; includeSubDomains
我有这个运行网络应用程序的子域: https://subdomain.website1.com/ 这在响应中也有以下标头:
Strict-Transport-Security: max-age=31536000; includeSubDomains
我想为 website1.com/ 的所有子域提供预加载功能。 但是,在检查eligibility 时出现以下错误:
Error: No HSTS header
Response error: No HSTS header is present on the response.
Error: HTTP redirects to www first
http://website1.com (HTTP) should immediately redirect to https://website1.com (HTTPS) before adding the www subdomain.
Right now, the first redirect is to http://www.website1.com/.
The extra redirect is required to ensure that any browser which supports HSTS will record the HSTS entry for the top level domain, not just the subdomain.
第一个错误很简单,我只需添加 HSTS 标头即可。
但是为什么有重定向很重要?
我只想让http://subdomain.website1.com/ 内部重定向到https://subdomain.website1.com/,并让http://website1.com/ 内部重定向到https://website1.com/。
无论是否重定向到www.website1.com/,http://website1.com 都不能进行内部重定向到https://website1.com?
【问题讨论】: