之前图床老出问题,http链接被自动跳转为https,最后发现是HTST(HTTP Strict Transport Security)的问题
HTTP Strict Transport Security (HSTS) is an opt-in security enhancement that is specified by a web application through the use of a special response header. Once a supported browser receives this header that browser will prevent any communications from being sent over HTTP to the specified domain and will instead send all communications over HTTPS. It also prevents HTTPS click through prompts on browsers.
只要关掉浏览器的HTST就好了
以Chorme为例,首先在地址栏输入:
chrome://net-internals/#hsts
然后找到域名删掉就可以了
但是,对于用户而言,体验太差
因此,最终我还是选择用nginx配置自动代理,将https代理到相应服务
思路很简单,假设这是原先服务的配置:
server { listen 80; server_name typora.fengxiangrui.top; location / { proxy_pass http://127.0.0.1:8888; } }
现在我们可以用htpp访问
server { listen 443; server_name typora.fengxiangrui.top; location / { proxy_pass http://127.0.0.1:8888; } }