Wordpress 从HTTPS到HTTP的意外页面重定向

Wordpress 从HTTPS到HTTP的意外页面重定向,wordpress,http,redirect,twitter,facebook-opengraph,Wordpress,Http,Redirect,Twitter,Facebook Opengraph,我正在使用Twitter卡测试一个页面,并使用以下方法测试提供的URL(我正在简化URL,但输出是有效的): 它正在拔卡,但警告如下: 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 h

我正在使用Twitter卡测试一个页面,并使用以下方法测试提供的URL(我正在简化URL,但输出是有效的):

它正在拔卡,但警告如下:

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

使用,它同样报告:

URL redirect trail
1   301 Redirect  https://example.net/hello/test-page/
2   200 Success  http://example.net/hello/test-page/
以及:

所以。。。我检查生成的网页的来源,我可以确认:

所有OG和Twitter卡相关的元标记和链接标记均未使用“http”。它们都是“https”。规范链接标记也使用“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站点,但我没有运行异常的插件)

问题在于托管提供商,在这种情况下是可按的,因为我们使用Lets加密SSL证书

以下是支持聊天中的相关部分:

发生这种情况的原因是因为在WordPress.com上没有 始终通过Let's Encrypt释放SSL证书。那么,关于 例如,Facebook上显示类似Facebook按钮的帖子 与计数将有一个规范的URL在Facebook一样 . 打开SSL和301重定向 将该页面的http://版本改为https://将清除这些内容 喜欢/分享很重要,因为Facebook看到的URL与 不同的协议是两件截然不同的事情

因此,实现必须提供SSL证书,并强制SSL用于 数以百万计的网站现在将有一个免费的让我们加密 SSL证书,但也需要给这些爬虫提供一种方法 通过http访问内容

在执行Let's Encrypt的可压实现时,很多 是从WordPress.com复制的,这样做是正确的。 Pressable也不总是有免费的SSL证书。如果我们开始 要强制将始终为http的站点重定向到https,请执行以下操作: 如果有“like”按钮和共享计数,那么这些计数将是 迷路了

不能说我对这个答案感到兴奋

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/
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