{
  "id": 14902120,
  "title": "Why Your og:image Works in the Browser but Not for Crawlers: Relative Paths, Redirects and Wrong Content-Types",
  "url": "https://urgent.news/2026/10/16/why-your-og-image-works-in-the-browser-but-not-for-crawlers-relative",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-16T07:53:43.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/abidali671/why-your-ogimage-works-in-the-browser-but-not-for-crawlers-relative-paths-redirects-and-wrong-2k6f"
  },
  "original_language": "en",
  "account": "When an image appears correctly in a browser but fails to load for crawlers, several URL-level issues could be the culprit. These problems often involve relative paths, redirects, or incorrect content types.\n\nFirst, ensure the og:image tag contains a full URL instead of a relative one. The Open Graph protocol requires the use of a complete URL. For example, instead of using /og/launch.png, set the content attribute to https://yoursite.com/og/launch.png. Some crawlers may resolve relative paths differently, leading to the image being requested from the wrong host.\n\nAnother issue could be redirects. A chain of redirects may cause the crawler to land on an incorrect page, such as a login page or the home page. To diagnose this, use the command curl -sIL -A LinkedInBot/1.0 https://yoursite.com/og/launch.png | grep -iE ^(HTTP|location|content-type) to see the number of redirects and the final URL. If the final URL is a web page instead of an image, the crawler won't display the image.\n\nThe server might also lie about the content type. Some storage buckets or frameworks may return files with incorrect content types, such as serving .png files as application/octet-stream or returning a web page instead of an image. To check the content type, use the command curl -s https://yoursite.com/og/launch.png -o /tmp/og.png && file /tmp/og.png. If the file is identified as an HTML document, the image URL is not pointing to a valid image.\n\nAdditionally, signed URLs, which expire after a certain period, can also cause issues with og:image. The tag gets updated once, and if the signed URL expires before the crawler revisits the page, the crawler won't be able to load the image. Instead, use a stable public URL that doesn't expire.\n\nSometimes, the image file itself may be too large or too small. A 6 MB PNG file can cause timeouts during the crawler's fetch, while a 150x150 logo might be too small to be used for large card images. Export the image in a compressed format, such as JPG or WebP, and ensure it's around 1200x630 pixels in size. Most platforms prefer JPG, PNG, or WebP formats.\n\nLastly, when updating the image, remember to version the URL to avoid serving the old image. Include a version number or a content hash in the filename, which most build tools already do for other assets.",
  "summary": "There is a special kind of frustration reserved for the image that works. You open https://yoursite.com/og/launch.png in a tab, it loads instantly, it looks great. You paste the page into LinkedIn and get a headline, a domain, and no picture. Most write-ups about broken link previews stop at \"make sure og:image is set\". This post is about the next layer: the tag is set, the file exists, and the…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}