在 Facebook 上共享自定义子域显示 link 到 heroku 应用程序

Sharing custom subdomain on Facebook shows link to heroku app

我最近在Heroku上部署了一个网站,并通过OVH购买了一个域名。

为了 link 我的自定义域到我的 Heroku 应用程序,我在这里关注了 Heroku 的文档:https://devcenter.heroku.com/articles/custom-domains#add-a-custom-domain-with-a-subdomain

一切顺利,我可以使用自定义域名访问我的网站。

唯一的问题是当我在 Facebook 上从我的网站分享 link 时,它会在预览中向 heroku 应用程序显示 link:https://example.com/test becomes https://example.herokuapp.com 在预览中.

知道为什么吗?

以防万一有人遇到相同类型的问题,WizKid 提供的 link 非常有用:https://developers.facebook.com/tools/debug/

对我来说,问题是 og:url 标签是通过 CANONICAL_ROOT_URL 配置变量直接在 Heroku 中设置的。