how to test open graph on localhost

DavidB picture DavidB · Dec 20, 2011 · Viewed 39.9k times · Source

I've done a lot of research and haven't found a definitive answer to this. Is there anyway to test the open graph on localhost? I don't haven any issues using the graph api on locahost.

I've changed my website url in the app settings and have even tried setting up a domain in my hosts file but the debugger linter for open graph tries to use the actual domain instead of my localhost and when using locahost directly the linter completely fails connecting.

Does anybody have any workarounds for this?

Answer

GabLeRoux picture GabLeRoux · Oct 18, 2017

Using a local proxy is the right solution. ngrok didn't work for me neither.

A similar tool that did work with facebook debugger is localtunnel

npm install -g localtunnel
lt --port 8000

Generates a url that looks something like https://<random_hash>.localtunnel.me/. Using this url in facebook open graph debugger worked for me as of October 18th 2017. I only had to hit Fetch new scrape information button. 🍻

Cool thing about localtunnel is that you can easily host your own localtunnel server with github.com/localtunnel/server so if it ever stops working with localtunnel.me, you can run your own somewhere in the cloud