问题原文
原帖链接 · Denis Pshenov · CC BY-SA 4.0
Nowadays most sites redirect HTTP traffic to HTTPS for requests to their pages. However the same can't be said for assets (images, js, css). Most of the assets are available under both HTTP and HTTPS. Is there any particular reason that access to assets via HTTP is not redirected as is the case with the requests to pages? Why not force HTTPS everywhere?
已采纳解答
原帖链接 · Peter Scott · CC BY-SA 4.0
It is true that the assets within HTTPS web pages should also be served through HTTPS but there are reasons to not try to force the web server to push every request to HTTPS for all incoming HTTP requests for that domain but continue to allow HTTP access.
- As a failsafe for https configuration mishaps
- To support clients that don't have https support
- Prefer to leave the enforcement of the HTTPS for assets within HTML served over HTTPS to the Application Layer and don't try to enforce at the Server Configuration Layer
This question confronts people when running the Certbot/Let's Encrypt tools for creating Free HTTPS SSL Certificates and configuring the Nginx or Apache Web Server. The Web Servers provide mechanisms to force clients that request http to redirect to the https version.
For general use it's probably safest and simplest to allow redirect to https and forced to use https. Just keep in mind that there are cases that may require deviating from this default.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
