首页 > 解决方案 > Prerender.io 的缓存 html 标头被静态标头替换

问题描述

我有一个 Heroku 应用程序,我在其中添加了一个 namecheap 域 ( https://www.platonic.chat/ )。我最近使用 Prerender.io 将 SEO 添加到应用程序中,因此应用程序上的特定页面具有动态链接预览。但是,namecheap 域不显示所需的动态链接预览。我可以在我的 Prerender.io 仪表板上看到它正确地缓存了页面,但是当缓存的 html 被获取时,缓存的 html<meta>的标签以某种方式被静态 index.html 的标签替换。<meta>

另一个提示是不使用 namecheap ( https://platonic-prod.herokuapp.com/ ) 的 Heroku 域没有这个问题。在 Heroku 域 ( https://platonic-prod.herokuapp.com/c/welcome-to-platonic ) 中,所需的标题元标记是:

<meta property=“og:title” content=“Welcome to Platonic”&gt;
.
.
.

但是在 namecheap 域(https://www.platonic.chat/c/welcome-to-platonic)中,标题元标记是:

<meta property=“og:title” content=“Platonic”&gt; 
.
.
.

"Platonic"是默认标题,但是当您访问不同的https://www.platonic.chat/c/时它应该会改变*

Prerender.io 在两种情况下获取的 html 的主体是相同的,所以在我看来,有些东西正在替换缓存 html 的标头。当我使用 Facebook Debugger 和 metatags.io 时,链接预览给出了不正确的结果,但是当我通过命令行使用 Googlebot 时,它给出了正确的结果curl -A Googlebot https://www.platonic.chat/c/welcome-to-platonic。那么,为什么在 Heroku 应用程序中添加一个 namecheap 域会在获取缓存的 html 时对其进行修改?

我正在为 Prerender.io 使用 ExpressJS 中间件,缓存 Angular 页面。

标签: herokuprerendernamecheap

解决方案


推荐阅读