From e8af16ae7c99d3d520b27eba0593353d984bdb22 Mon Sep 17 00:00:00 2001 From: Ali Piry Date: Mon, 7 Aug 2023 12:29:13 +0330 Subject: [PATCH] omit X-Robots-Tag to noindex on vercel dev/preview envs --- next.config.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/next.config.js b/next.config.js index 7f2f57c..fd32181 100644 --- a/next.config.js +++ b/next.config.js @@ -4,6 +4,24 @@ const nextConfig = { eslint: { ignoreDuringBuilds: true, }, + async headers() { + const headers = []; + + if (process.env.APP_ENV !== "production") { + headers.push({ + headers: [ + { + key: "X-Robots-Tag", + value: "noindex", + }, + ], + + source: "/:path*", + }); + } + + return headers; + }, }; module.exports = nextConfig;