X-Robots-Tag: the hidden header that can block indexing

By the SEOAlertly team · Updated · 6 min read

X-Robots-Tag is an HTTP response header that gives search engines the same instructions as a robots meta tag. It is sent before the page content, so you will not find it by viewing the page source. If Search Console says a page is noindexed but there is no tag in the HTML, this header is almost always the reason.

What it looks like

HTTP/2 200
content-type: text/html; charset=utf-8
x-robots-tag: noindex

It can carry the same values as the meta tag, such as noindex, nofollow, none, noarchive and nosnippet. It can also target one crawler, for example X-Robots-Tag: googlebot: noindex.

Why sites use it

The trouble starts when a staging rule is copied to production, a CDN rule matches too broadly, or a framework decides the live site is “not production”.

How to check for X-Robots-Tag

In the browser

  1. Open developer tools (F12) and go to the Network tab.
  2. Reload the page and click the first request, the page itself.
  3. Under Response Headers, look for x-robots-tag.

From the command line

curl -sI https://example.com/page | grep -i x-robots-tag

No output means no header. Check the final URL after redirects too: add -L to follow them, since a rule may apply only to the destination.

With Search Console or SEOAlertly

Search Console’s live URL test reports a noindex found in the HTTP header. SEOAlertly’s site check reads the X-Robots-Tag header on every sampled page and shows the exact directive it found.

How to remove it

First find which layer adds the header: your application, the web server, or a CDN or host in front of it. Then remove or narrow the rule.

Apache (.htaccess or server config)

# Look for lines like this and remove them,
# or limit them to the files that need them
Header set X-Robots-Tag "noindex"

# Example: noindex only PDF files
<FilesMatch "\.pdf$">
  Header set X-Robots-Tag "noindex"
</FilesMatch>

Nginx

# Remove this from the server or location block
add_header X-Robots-Tag "noindex";

Reload Nginx after the change, for example with sudo nginx -s reload.

Netlify, Vercel and similar hosts

Look in netlify.toml, _headers or vercel.json for an X-Robots-Tag header rule. Make sure your custom production domain is not being served as a preview. A preview header on a preview URL is normal; on your live domain it is not.

Next.js and other frameworks

Search the project for X-Robots-Tag. In Next.js, check the headers() function in next.config and any middleware that sets response headers.

CDNs such as Cloudflare

Check transform rules, workers and page rules that modify response headers. A rule written for a staging hostname can match more than you expect.

After you remove it

  1. Purge your CDN cache, then confirm the header has gone with curl -sI.
  2. Run Test live URL in Search Console and request indexing.
  3. Check that robots.txt is not blocking the URL. Google needs to crawl the page to notice the change.

For noindex inside the HTML, see how to find and remove a noindex tag.

Related guides