Are Vercel Preview Deployments indexed by search engines?

Information on whether a Vercel Deployment will be indexed by search engines.
Last updated on March 6, 2024
Edge Network & Caching

For SEO purposes, it's necessary to ensure that your website is not serving duplicate content. It is important to ensure you are not hosting the same content at more than a single URL.

Given the nature of Preview Deployments, and the way they are designed to give a realistic representation of a Production Deployment, they serve duplicate content by default. This article outlines how this case is handled by Vercel, to ensure your SEO ranking is not negatively impacted by duplicate content.

Vercel Preview Deployments are not indexed by search engines by default because the X-Robots-Tag HTTP header is set to noindex. If you are using a Custom Domain that is assigned to a non-Production Branch, however, the header X-Robots-Tag: noindex will not be set.

To confirm the value of the X-Robots-Tag header, you can use the following curl (already available on most desktop devices) command in your terminal to check your Preview Deployment's headers:

curl -I <preview-deployment-url>
Using the curl command to check your Preview Deployment's headers.

Amongst the output, you will find an X-Robots-Tag header after executing the curl command.

x-robots-tag: noindex
Verifying your Preview Deployment's headers using the terminal.

If you are using a Custom Domain for your preview deployments and wish to override the default behavior of omitting X-Robots-Tag: noindex, you should first look to inject the response header using your framework's built-in methods.

module.exports = {
async headers() {
const headers = [];
if (process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
headers.push({
headers: [
{
key: 'X-Robots-Tag',
value: 'noindex',
},
],
source: '/:path*',
});
}
return headers;
},
};
Adding this to your next.config.js file is the preffered method for injecting the X-Robots-Tag: noindex response header in your Next.js app.

If you are not using a framework or your framework does not support injecting response headers, you may modify the Header object in your vercel.json file.

{
"headers": [
{
"source": "/",
"has": [
{
"type": "host",
"value": "example.com"
}
],
"headers" : [
{
"key" : "X-Robots-Tag",
"value" : "noindex"
}
]
}
]
}
Injects the X-Robots-Tag: noindex for the specified host in your vercel.json file.
NOTE: Please note that using your framework's built-in methods to inject headers is always recommended and doing so through vercel.json should only be as a last resort and may lead to other problems.

If you believe your Preview Deployment is not showing the correct header, please contact Vercel Support using the support form available from the Vercel dashboard.

Couldn't find the guide you need?