Staging environments

Staging noindex leaked to production: the env flag

One environment variable decides where the noindex header or meta tag goes, and a wrong value noindexes production. How the leak happens, how to trace it.

Production returns noindex when the environment flag that scopes it to staging holds the wrong value, so the conditional header or meta tag fires on every response. Inspect the live response headers and meta tags, find the conditional in code or server config, correct the environment value, redeploy, and verify production is clean.

Why Staging environments does this

The common pattern is one line that branches on the environment: a Next.js headers() gated on "process.env.VERCEL_ENV", an nginx block like "add_header X-Robots-Tag "noindex" always" behind an if or map on a variable, an .htaccess rule scoped to a host check, or a template writing "<meta name="robots" content="noindex"> when an IS_STAGING flag reads true. The flag is set in a dashboard, a .env file, or the deploy pipeline, and the production value goes wrong in documented ways: a variable copied from the staging config, a name typo that fails the equality check in the wrong direction, a deploy that carries staging secrets forward, or a CDN rule written for staging that matches the production host too. Vercel's own system variables resolve per environment, which is why a check against the wrong literal still builds cleanly and ships wrong.

Check it right now

Before changing anything, confirm what a crawler actually sees. The check is free, takes one URL and needs no account.

Run the check

Or run the robots.txt tester against the same URL to see the exact rule that applies.

How to fix it

  1. Run the X-Robots-Tag checker on the affected production URL and record the exact header value.
  2. View source on the page and check for a robots meta tag too; the leak can arrive as either a header or a tag.
  3. Search the codebase for the conditional: look for noindex in framework header configs, server blocks, .htaccess, and templates, and note which variable each one branches on.
  4. Compare that variable's production value in the deploy dashboard or environment file against the value the code expects.
  5. Correct the value or the comparison, redeploy, and run the checker again on production.
  6. Confirm staging still returns its noindex; a fix that strips both environments just trades one incident for another.

Why it happens again

The scoping flag is infrastructure, so it is invisible in content work and code review rarely covers environment values. Every new environment, rename, or copy-pasted config re-rolls the dice, and the failure ships green: builds succeed, pages render, only the header differs.

stillindexed re-checks the URLs you give it every 30 minutes on Starter and alerts when a directive changes, at most 30 minutes after it does. It is a monitor rather than a crawler: it watches a list you choose and tells you when one of seven things changes. Start with a 30-day free trial, 3 sites, no card required, and a 30 day refund after that.

Start the 30-day free trial, 3 sites, no card required

Catching it next time

Fixing it once is the easy half. The setting that caused this can be changed again by anyone with access, and the page will keep returning 200 while it happens.

A noindex tag hiding the site from search, on other platforms

How Search Console reports it

Sources

Every claim about Staging environments above is from their own documentation, read on 2026-10-25. Platforms change their settings; if one of these is out of date, their page wins and we would like to know.