大网数据广告活动
服务器运维问答

Should assets still be available under HTTP or be force redirected to HTTPS?

· 52CE 我爱测

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 reas…

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-10-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。