How do I add an X-Robots-Tag header on Vercel?

The Citead team, updated

In short. Add a headers rule with a source path and an X-Robots-Tag key and value in vercel.json, then inspect the deployed response.

Definition: An X-Robots-Tag is an HTTP response header that carries indexing instructions for search engines. On Vercel, a headers rule in the project's vercel.json file attaches that header to responses for matching URL paths.

Key facts

  • As of October 2026, Vercel's configuration reference defines source as a pathname pattern that excludes the query string.
  • Google's robots specification supports X-Robots-Tag: noindex for excluding a resource from search results, including non-HTML resources.
  • Google's noindex guidance requires the resource to remain accessible to its crawler so the instruction can be read.
  • Vercel's response header documentation describes automatic noindex headers on preview deployments and outdated production deployments.

What goes in vercel.json?

Vercel's configuration reference places vercel.json in the project root. The following adapted example applies noindex to the exact path /secrets/unicorn.pdf, the PDF path used in Google's robots specification:

{
  "headers": [
    {
      "source": "/secrets/unicorn.pdf",
      "headers": [
        {
          "key": "X-Robots-Tag",
          "value": "noindex"
        }
      ]
    }
  ]
}

The outer headers array contains route rules. Within each rule, source selects the incoming pathname and the inner headers array contains response header names and values. In an existing configuration, this rule belongs alongside the other header rules.

Vercel's all-route example uses "source": "/(.*)". Using that pattern with noindex extends the instruction across all matching paths, so the exact-path example provides a narrower starting point. A query string is outside the source match; Vercel documents has conditions for matching query parameters.

What does noindex change?

Google's robots specification makes robots meta tag rules available through X-Robots-Tag. This makes the header suitable for a PDF, where an HTML meta tag is unavailable. The example's intended response field is:

X-Robots-Tag: noindex

The same specification applies the more restrictive instruction when robots rules conflict. An existing noindex therefore matters when reviewing other indexing settings on the page.

Google's noindex guidance requires crawl access. Blocking the same URL in robots.txt prevents Googlebot from reading the header. Google must crawl the resource after the change before it can process the instruction.

How is the deployed header checked?

Vercel's response header documentation recommends browser developer tools or curl -I. For the example path, the inspection command is:

curl -I https://example.com/secrets/unicorn.pdf

The hostname is a placeholder for the deployed domain. Inspect the response for X-Robots-Tag and its value. Compare the intended production URL with any preview URL: Vercel automatically adds noindex to preview deployments and outdated production deployments, so a preview response alone cannot verify the custom rule's effect on production.

FAQ

Can I use this for an HTML page?

Yes. Google's robots specification allows robots meta tag rules in the HTTP response header. Set the Vercel rule's source to the page's pathname.

Where can I monitor Google's processing?

Google's noindex guidance names Search Console's Page Indexing report for monitoring pages where Googlebot extracts noindex. You can also request a recrawl through the URL Inspection tool.

Sources

  1. Vercel, "Static Configuration with vercel.json", 14 August 2026
  2. Google Search Central, "Robots meta tag, data-nosnippet, and X-Robots-Tag specifications", 24 March 2026
  3. Google Search Central, "Block Search indexing with noindex", 10 December 2025
  4. Vercel, "Response headers", 11 August 2026

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark