Eddie Jaoude posted one of those “who has a side project, share it below” threads on X, so I dropped a link to My Yarn Stash. The preview card came back broken. No banner, no description, just a gray box with a placeholder icon and a truncated title.
Which was extra annoying because I had already fixed the Open Graph and Twitter Card meta tags in PR. The tags were there. The image existed. The card still refused to render.
So I asked Grok to investigate, and it came back with two separate problems.
Problem 1: the image was too heavy

The OG image you can see above was a 2.4 MB PNG. The official limit is 5 MB, so technically that passes, but in practice large PNGs frequently time out or get skipped by the card crawler. Not worth the risk for a banner.
The dimensions were a bit off too. Mine was 1536x1024, and the classic recommendation is around 1.91:1, so 1200x630. On its own that’s usually not fatal, but it wasn’t helping.
Honestly, this one was overdue. I made that image when I first built the app and never touched it again because it was always low priority. So I took the opportunity to redo it and create a more “product-y” version of it:

Problem 2: HEAD requests returned 405
This one was something new to me.
A plain curl -I https://myyarnstash.app/ came back with 405 Method Not Allowed. A normal GET works perfectly and returns the full page with every meta tag in place.
Quick note before going further: this is the HTTP HEAD method. Nothing to do with Git HEAD.
GET vs HEAD in one line each
GETmeans “give me the full page”, headers plus the HTML body.HEADmeans “give me only the headers for this page, skip the body”.
HEAD is the lightweight way for bots and crawlers to check that a URL exists and is healthy without downloading the whole thing.
Why that kills the card
Twitterbot often sends a HEAD request first when it wants to build a link preview. Only if that response looks healthy does it follow up with a real GET to read og:image, twitter:image and the rest.
My FastAPI app only defined a GET route for /. Recent versions of FastAPI and Starlette do not automatically accept HEAD on GET routes. So what the crawler saw was:
GET /returns 200 OK, page loads fine in a browserHEAD /returns 405 Method Not Allowed
The crawler hits that 405 and bails out before it ever fetches the body. Perfect meta tags that nobody reads.
By the way, if I’d had my local Share Preview project, I would have caught it earlier:

The fix
The same landing page handler just needs to accept HEAD too:
|
|
|
Or the two decorator version:
|
|
|
|
The response body is automatically omitted for HEAD, so the same function covers both cases.

With that tiny change, crawlers stop getting a 405 and can actually read the Open Graph and Twitter Card tags that were already sitting there.
With both fixes live, the card finally shows up like this on an actual post:

Learnings
When a preview card breaks, the instinct is to go straight to the meta tags. Mine were fine the entire time. The two things actually standing in the way were a file I never bothered to optimize and a route that quietly rejected half the requests a crawler makes.
Worth adding curl -I on your own homepage to the debugging checklist if you haven’t yet.