You have added Open Graph tags to the site you are building and want to see the preview before it goes live. You paste http://localhost:3000 into Facebook's Sharing Debugger, or send it to yourself on WhatsApp, and get nothing: an error, a bare link, or no card at all.
That is expected. This guide explains why, how to give your local site a temporary public address so the preview tools can reach it, and the one mistake that still breaks the image even after you do.
The short answer: link previews are built by the app's servers, not by your browser, and those servers cannot see your computer. Run a tunnel such as cloudflared tunnel --url http://localhost:3000 or ngrok http 3000, make sure your og:image and og:url use the tunnel's address rather than localhost, then test that public URL in the Share Preview Checker or each platform's own debugger.
Why localhost never previews
When you share a link, the app does not ask your browser for the page. Facebook, WhatsApp, LinkedIn, Slack, Discord and the rest each send their own crawler from their own servers to fetch the URL, read the meta tags, and download the image.
To those servers, localhost and 127.0.0.1 mean the crawler's own machine, not yours. Addresses on your home or office network, like 192.168.1.20, are private and unreachable from the internet too. So the crawler either fails to connect or refuses the address outright. No preview tool that works from the outside, including ours, can fetch them. The fix is to give the crawler an address it can reach.
Option 1: a tunnel (quickest)
A tunnel gives your local server a temporary public HTTPS address. Requests to that address travel through the tunnel provider to your machine. Three common choices:
- Cloudflare quick tunnel. With cloudflared installed, run
cloudflared tunnel --url http://localhost:3000. It prints a randomtrycloudflare.comaddress. No account is needed for a quick tunnel. - ngrok. After signing up and adding your auth token, run
ngrok http 3000and use thehttps://forwarding address it shows. - Your editor's port forwarding. VS Code can forward a port from the Ports panel. Set the port's visibility to Public, otherwise the address requires a GitHub sign-in and crawlers will get a login page instead of your site.
Change 3000 to whatever port your dev server uses. Then open the public address in a private browser window first. If you see your site, the crawlers can probably reach it too.
Watch for interstitial pages. Some free tunnel plans show a warning or reminder page to visitors before passing them through. If a preview comes back with the tunnel provider's title or logo instead of yours, the crawler got that page rather than your site. Try a different tunnel or check the provider's documentation for how to skip it.
Option 2: a preview or staging deployment
If your host creates a preview deployment for each branch (Vercel, Netlify, Cloudflare Pages and others do), that URL is public and works the same way. Two things commonly break previews on staging sites:
- Password protection. HTTP basic auth or a "protected deployment" setting returns a 401 to crawlers, so they see nothing. Turn it off for the test, or use a tunnel instead.
- Blocking crawlers. A staging robots.txt that disallows everything is fine for search engines, but some preview crawlers respect it and will not fetch the page. If previews work on production but not staging, compare the two robots.txt files.
The mistake that still breaks the image: absolute URLs pointing at localhost
This is the most common reason a tunnel test half-works: the title and description show, but the image does not.
og:image must be a full, absolute URL. Most frameworks build it from a "site URL" setting, and in development that setting is usually http://localhost:3000. So the page you serve through the tunnel says:
<meta property="og:image" content="http://localhost:3000/og.png">
The crawler reaches your page through the tunnel, reads that tag, and then tries to download the image from localhost, which fails. Look at the page source through the tunnel address and check every URL in the og: and twitter: tags. They all need the tunnel host.
How to fix it depends on the framework:
- Next.js (App Router): image URLs are resolved against
metadataBase. When it is not set, Next.js falls back tohttp://localhost:3000in development and logs a warning about it. SetmetadataBasefrom an environment variable and point that variable at your tunnel address while testing. - Other frameworks and static site generators: look for the base URL or site URL setting (often
SITE_URL,BASE_URL,urlorbaseURLin the config) and set it to the tunnel address for the test. - Hand-written HTML: write the full URL into the tag.
Do the same check for og:url. Facebook treats it as the canonical address and may fetch that URL instead of the one you pasted, so an og:url of localhost sends it straight back to an address it cannot reach.
Testing the preview
With a public URL, test in this order:
- Check the tags in one place. Paste the tunnel URL into the Share Preview Checker. It fetches the page as a crawler would, shows the WhatsApp, Facebook, LinkedIn, X, Discord, Slack, Telegram and iMessage previews side by side, and lists what is missing, such as an image that is too small, a relative image URL, or an image the crawler cannot download.
- Confirm on the platforms that have their own tool. Facebook's Sharing Debugger and LinkedIn's Post Inspector both need you to be signed in. Use "Scrape Again" in Facebook's tool after every change, because it caches the first result.
- For apps without a debugger, such as WhatsApp, iMessage and Telegram, send the link to yourself. Use a fresh URL for each attempt, for example by adding
?v=2, because these apps cache previews and will keep showing the first one. Our guide to clearing a link preview cache on each platform covers the details.
Close the tunnel when you are done
A tunnel makes your development server reachable by anyone who has the address, including any debug pages, admin screens or test data it exposes. Keep it running only while you test, stop it afterwards, and avoid tunnelling a dev server that is connected to real customer data.
Common questions
Can I test Facebook previews without a public URL at all?
Not with Facebook's own tools. You can read the tags in your page source and check sizes yourself, but only a crawler fetching the page from outside shows you what the platform will really do. A tunnel is the closest you can get without deploying.
Will the preview look the same once the site is live?
Yes, if the production pages serve the same tags with your real domain in them. After launch, check one live page again: the production domain is a new URL to every platform, so they all fetch it fresh.
Why does my image work in the browser but not in the preview?
Usually one of three things: the URL is relative or points at localhost, the image is behind authentication or blocked for crawlers, or it is too large or too small for the platform. The WhatsApp preview image guide goes through the size and format limits in detail.
Short version
Preview crawlers run on the platform's servers and cannot see localhost. Expose your dev server with a tunnel or use a public preview deployment, make every og: URL use that public address instead of localhost, test the public URL in a preview checker and the platform debuggers, then close the tunnel.