DEV Community

seotto.com
seotto.com

Posted on

Case study (hypothetical): a CDN cached a staging 'noindex' header on 4,000 product pages for 11 days

Automated technical SEO checks that catch indexing blocks and deploy regressions — seotto.com

This is a hypothetical case study. The shop and the numbers are invented, but every step is something that happens when caching, headers and staging configs meet.

The setup

An online shop with about 4,000 product pages. The origin runs on a couple of application servers behind a CDN. Product pages are cached at the CDN for 30 days, because they change rarely and the shop gets traffic spikes; a purge API clears individual URLs when a product is edited.

The team is moving the origin to a new hosting provider. The new environment was built from the staging configuration, which includes, quite reasonably for staging, this line in the web server config:

add_header X-Robots-Tag "noindex, nofollow" always;
Enter fullscreen mode Exit fullscreen mode

The incident

Day 0, 10:00. As part of a migration rehearsal, the team switches the CDN's origin to the new environment for the whole morning, to test performance under real traffic. Pages load correctly. Nobody looks at response headers; the header doesn't change anything users can see.

Day 0, 13:30. The origin is switched back. The rehearsal is declared a success. The add_header line is noticed in a config review that afternoon and removed from the new environment.

What nobody considered: during those three and a half hours, every product page that was requested and not already in the cache (it had been purged before the rehearsal, to make the performance test realistic) was fetched from the new origin, with the noindex header, and cached for 30 days. A busy morning plus Googlebot's own crawling touched almost the whole catalogue: about 4,000 pages.

Worse, the CDN's cache key didn't vary by user agent, and the cache was shared, so Googlebot got exactly the same cached response as everyone else, header included.

Day 0 to Day 10. Googlebot crawls product pages as usual. For the cached URLs, it receives X-Robots-Tag: noindex, nofollow and drops them from the index as it recrawls. Each also stops passing link signals to the pages it links to.

Day 9. The SEO lead notices organic traffic to product pages is down about 40% week on week. Search Console's page indexing report shows a growing "Excluded by 'noindex' tag" group. The team checks the templates: no noindex. They check the origin: no header.

Day 10. Someone curls a product page through the CDN and sees the header. The cached copy is the culprit.

Day 11. A full CDN purge clears every cached page. The team requests indexing for the top 200 products and validates the fix in Search Console. Recovery takes about three weeks.

The origin was fixed within hours; the problem lived in the cache for 11 days. seotto.com checks what crawlers actually receive from the public URL, headers included, so a cached noindex shows up as an indexing block the day it appears, not when traffic drops.

What went wrong

1. Production traffic hit a staging-configured origin. The rehearsal was a good idea. Doing it with staging headers still in place wasn't.

2. Nobody checked headers. The rehearsal checks were about whether pages loaded and how fast. X-Robots-Tag is invisible in the browser, so it never came up.

3. A long CDN TTL turned a morning's mistake into an 11-day one. The cache did exactly what it was told. Every bad response it stored would have lived for a month.

4. "Fix the origin" was assumed to fix the site. After removing the header, nobody purged the cache, because nobody knew the bad responses had been cached.

5. Debugging started at the template. Everyone looked for a meta tag first. The header was only found when someone looked at the raw response from the public URL.

What they changed

Strip robots headers at the edge for production. The CDN now removes any X-Robots-Tag header coming from the origin on the production hostname, except for an explicit allow-list of paths (like /search and /account/) where noindex is intended. A staging config can no longer leak through.

Don't cache responses with a noindex header. As a second layer, a CDN rule bypasses caching for any origin response carrying X-Robots-Tag: noindex. Even if one gets through, it isn't stored.

Rehearsals have a header checklist. Before switching traffic, compare response headers from the old and new origins for a sample of URLs. X-Robots-Tag, Cache-Control, Link (for canonicals in headers), Location and Content-Type all have to match.

Purge after every origin switch. Any time the origin changes, even for a test, the runbook ends with a full purge.

Monitor the public URL, from outside, for robots directives. A daily check on a sample of product URLs, through the CDN, for both the meta tag and the header. It costs nothing and would have flagged this on Day 0.

How to check your own site in two minutes

Pick five important URLs and request each through the public hostname, the way a crawler would:

for u in / /products/example /category/shoes /blog/ /about; do
  printf '%s  ' "$u"
  curl -sI -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" \
    "https://www.example.com$u" | grep -iE '^(x-robots-tag|cache-control|age|cf-cache-status|x-cache):' | tr '\r\n' '  '
  echo
done
Enter fullscreen mode Exit fullscreen mode

Any X-Robots-Tag you didn't expect is a problem. A large Age value next to it tells you the response came from cache, and roughly how long it has been sitting there, which tells you whether purging is part of the fix.

What I'd take from it

  • Indexing directives can come from headers, and headers can come from caches.
  • Every staging-only safety measure needs a "can this ever reach production?" review.
  • Long TTLs magnify every mistake. Make sure bad responses aren't cached.
  • Check what the public URL returns, not what the origin or the template says it should.

Related reading

Have you ever had a cache keep serving a fix's "before" state long after the fix? What was it caching?

Top comments (0)