Getting Facebook meta tags to work with Heroku on a custom domain

I have a domain that points to a Heroku dyno running a Node.js web app. To facilitate sharing, I added Facebook Open Graph meta tags to the html headers. However, I could not get Facebook to “see” the tags in the Facebook Sharing Debugger using my custom domain, even trying multiple variations of meta tags to be more attractive to Facebook’s crawler without luck. I could not find a solution from search engines or in the typical troubleshooting forums like stackoverflow.

Finally, I tested the Debugger using the direct heroku url (like , and all the meta tags immediately were recognized. Then I entered my custom domain, and voilà, all the meta tags were picked up there as well. I tested adding the link to a post in facebook, and the proper preview displayed.

I assume the redirect from a custom domain to a heroku url interrupts Facebook’s crawler, but once Facebook caches the meta tags at the target domain, it can properly display them using the custom domain. I am interested to hear a more technical explanation to this in the comments.

Hope this tip helps!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
George Marzloff

George Marzloff


Physician in Spinal Cord Injury & Physical Medicine and Rehab @ Rocky Mountain Regional VAMC, Colorado. Interests: Rehab Engineering & software development