DEV Community

Mohamed Gado
Mohamed Gado

Posted on Originally published at mohamedgado.com

wsrv.nl and robots.txt: every image in my sitemap was blocked for Google

Search Console read all four sitemaps of Reely with zero errors, so for weeks I logged them as clean. The warnings column next to it said something else: a warning on every single image entry. 787 of 787 in the core sitemap, 7,336 of 7,337 for movies, 5,772 of 5,772 for TV shows. The cause was the image proxy. Every poster URL went through wsrv.nl, and wsrv.nl's robots.txt disallows any URL with a query string. A wsrv URL is nothing but a query string, so Googlebot-Image was not allowed to fetch a single one.

Why the image host's robots.txt matters

Google applies robots.txt per host. Your own robots.txt can allow everything, and it still says nothing about images served from another domain. When Googlebot-Image reads <image:image> in your sitemap, or the image field in your JSON-LD, it checks the robots.txt of the host in that URL before it fetches.

Reely gets its posters from TMDB and resizes them through wsrv.nl, a free image proxy. A poster in the sitemap looked like this:

https://wsrv.nl/?url=image.tmdb.org/t/p/original/abc.jpg&w=500&output=webp
Enter fullscreen mode Exit fullscreen mode

What wsrv.nl's robots.txt says

The file has two groups for User-agent: *. The first one comes from Cloudflare's managed robots.txt and is friendly:

User-agent: *
Content-Signal: search=yes,ai-train=no,use=reference
Allow: /
Enter fullscreen mode Exit fullscreen mode

The last lines of the file are the ones that matter:

User-agent: *
Disallow: /*?*
Allow: /$
Enter fullscreen mode Exit fullscreen mode

You might read the first group as winning. It doesn't. Google merges every group that names the same user agent into one, and when an Allow and a Disallow both match a path, the longer rule wins. /*?* is longer than /, so any path with a ? in it is disallowed. Only the bare homepage (/$) is explicitly allowed. That covers every image URL wsrv.nl can serve.

How the warning count gave it away

The warning text in Search Console is generic, and a few warnings on a sitemap are normal. What stood out was the exact match: the number of warnings in each file equalled the number of <image:image> entries in that file. Pages had no warnings and images all did, in all three files. A broken page, a slow server or a bad tag doesn't hit every image in every sitemap. The only thing those images shared was the host.

From there it took one request:

curl -s https://wsrv.nl/robots.txt | tail -4
Enter fullscreen mode Exit fullscreen mode

Before the fix I had only looked at the errors field. My daily SEO script printed errors and skipped warnings, so the problem sat in plain sight for weeks.

The fix: plain URLs for crawlers, the proxy for people

I didn't drop wsrv.nl. It does a good job for visitors: it resizes, converts to WebP and caches at the edge. What changed is which URL goes where.

TMDB serves fixed sizes from plain paths, and image.tmdb.org/robots.txt returns a 404. Under the robots.txt rules, a missing robots.txt means everything is allowed. So I added one helper that builds the plain URL:

// For crawlers: a plain TMDB size, no query string.
export const crawlerImage = (path: string, size: 'w500' | 'w1280' = 'w500') =>
  `https://image.tmdb.org/t/p/${size}${path}`
Enter fullscreen mode Exit fullscreen mode

Everything a crawler reads raw now uses it:

  • the image sitemap entries
  • the image field in the Movie, TVSeries and Person JSON-LD
  • ItemList entries on collection pages
  • the JSON-LD the Cloudflare Worker renders for titles that aren't prerendered

On-page <img> tags still go through wsrv.nl, because a person's browser doesn't read robots.txt. Open Graph and Twitter images also stay on wsrv.nl: link-preview bots from Facebook, X, Slack and Discord fetch those, and I check them with a separate unfurl probe.

Check every host your crawlers touch

This isn't only about wsrv.nl. Any image CDN, resizer or proxy you put in front of crawler-facing URLs has its own robots.txt, and the operator can change it at any time. A short list to check:

  • Pull every distinct host out of your sitemaps and structured data.
  • Fetch /robots.txt on each one. Look for Disallow rules that match your URL shape, especially /*?*.
  • Remember the merge rule. A friendly Allow: / at the top doesn't help if a longer Disallow comes later.
  • In Search Console, read the warnings column on the Sitemaps report as well as errors. A warning count that equals your image count points at a systemic cause.

Takeaways

  • Google obeys the robots.txt of the image's own host, not yours.
  • wsrv.nl disallows /*?*, so every wsrv URL is blocked for Googlebot-Image.
  • Use a plain, query-free origin URL in sitemaps and JSON-LD, and keep the proxy for on-page images.
  • Warnings on every row of a sitemap mean one cause. Match the count against what the rows have in common.

For the other half of getting pages into Google, see Discovered, currently not indexed.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

This is a superb debugging story, Mohamed — the kind of bug that hides precisely because everything looks clean. Zero errors on all four sitemaps is exactly the signal that would make most people move on, and the detail that cracked it for me was the warning count matching the shape of the data: 787 of 787 in the core sitemap, every image row, pages untouched. That pattern — warnings on every row of one kind — is the fingerprint of a single shared cause, and you read it correctly.

Two things here deserve more attention than they usually get. First, robots.txt is per-host, not per-site, which is counterintuitive until you have been bitten by it: your own robots.txt can allow everything and it says nothing about an image served from another domain. Second, the merge rule — the longer Disallow: /? wins over the friendly Allow: / — is the kind of spec detail that only shows up when you actually curl the file and read the last four lines, as you did.

Your fix is the elegant part: plain TMDB URLs for crawlers, wsrv.nl kept for real visitors, since a browser never reads robots.txt. Did the warnings clear in Search Console after the next crawl, and did you check the Open Graph images too, since those go through the same proxy path?