如何解决意外的页面从HTTPS重定向到HTTP
我正在测试带有Twitter Cards的页面,并使用Twitters card preview tool测试提供的URL(我正在简化URL,但输出有效):
https://example.net/hello/test-page/
它正在拉卡,但有以下警告:
INFO: Page fetched successfully
INFO: 16 metatags were found
INFO: twitter:card = summary_large_image tag found
INFO: Card loaded successfully
WARN: this card is redirected to http://example.net/hello/test-page/
这里唯一的区别是HTTPS已切换为HTTP。不只是Twitter,还有FB和LinkedIn。
它使用LinkedIn's link preview tool类似地报告:
URL redirect trail
1 301 Redirect https://example.net/hello/test-page/
2 200 Success http://example.net/hello/test-page/
Response Code
200
Fetched URL
https://example.net/hello/test-page/
Canonical URL
http://example.net/hello/test-page/
Redirect Path
Input URL -> https://example.net/hello/test-page/
301 HTTP Redirect -> http://example.net/hello/test-page/
og:url Meta Tag -> https://example.net/hello/test-page/
所以...我检查了生成网页的来源,并且可以确认:
所有与OG和Twitter卡相关的META和LINK标签均未使用“ http”。它们都是“ https”。规范的LINK标记也使用“ https”。
如果我在浏览器中手动转到URL的“ http”版本,它将立即将我重定向到“ https”版本。
谁能解释为什么会发生这种情况,以及我应该开始挖掘的地方?
最后一个示例,当我在Terminal中运行此curl命令时,它似乎也不错:
curl -sLD - https://example.net/hello/test-page/ -o /dev/null -w '%{url_effective}'
HTTP/2 200
server: nginx
date: Sun,23 Aug 2020 16:27:28 GMT
content-type: text/html; charset=UTF-8
strict-transport-security: max-age=31536000
vary: Accept-Encoding
last-modified: Sun,23 Aug 2020 16:23:11 GMT
cache-control: max-age=43,must-revalidate
x-nananana: Batcache-Hit
vary: Cookie
x-ac: 2.ord _atomic_dca
(如果相关,这是一个WordPress网站,但我没有运行任何异常的插件)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。