Guides

Caching and rescrape

Social networks and CDNs treat og:image as a separate HTTP resource. Deterministic OGKit URLs cache well — which is great for performance and bad when you forget how to bust a stale preview. This guide covers both sides.

What OGKit sends

Template routes return Cache-Control: public, max-age=0, s-maxage=31536000, stale-while-revalidate=86400 — browsers revalidate; shared CDNs may keep the PNG for up to a year while allowing stale serves during revalidation.

Auto routes use a shorter shared max-age (about one day) because the upstream page can change.

  • Identical query string → identical bytes → CDN hit
  • Change title/subtitle/accent → new URL → new cache object
  • demo=1 and production key URLs are different cache keys

Design URLs for cache friendliness

Avoid random query params (_t=, timestamps) in production metadata. Use them only in Playground or local debugging.

When content changes materially, either update fields in the OGKit URL (preferred) or append a version param you control (v=2026-08-09) and update HTML metadata so scrapers request the new object.

Platform rescrape checklist

  • Facebook / Instagram — Sharing Debugger: scrape again
  • LinkedIn — Post Inspector
  • X / Twitter — Card Validator (availability varies); version the image URL if stuck
  • Slack — often caches aggressively; version the image URL or wait; opengraph.xyz helps inspect tags
  • Discord / iMessage — usually follow og:image; versioning helps after redesigns

Debug workflow

1) Open your page HTML and confirm absolute og:image and twitter:image match.

2) curl -I the image URL — check content-type image/png and cache headers.

3) Preview in Playground or opengraph.xyz.

4) Force rescrape in Facebook/LinkedIn after deploy.

curl -sI "https://www.webmorp.art/ogkit/api/og/minimal?demo=1&title=Hello" | grep -iE 'HTTP|content-type|cache-control'

Common mistakes

  • Relative og:image paths — scrapers resolve against the wrong host
  • Updating page copy but leaving the same OGKit title in metadata
  • Putting API keys only in client JS — crawlers never see the updated URL
  • Expecting Slack to drop cache without a new image URL

FAQ

Why is Slack still showing the old card?

Unfurl caches are sticky. Change the image URL (new fields or v=) and reshare, or wait for eviction. Confirm HTML already points at the new URL.

Should I set max-age on my HTML page too?

HTML caching is separate. Keep page HTML fresh enough that crawlers see new og:image values; the PNG can be cached longer once the URL is correct.

Does signed URL signing break CDN cache?

No — sig is part of the URL. As long as the signature is stable for the same fields, CDNs cache that exact URL.

Related

OGKit turns one HTTPS URL into a 1200×630 Open Graph image. Read the API reference, deep guides, the Open Graph SEO guide, try the Playground, or sign in to create API keys.