Skip to content

Commit 9e40e18

Browse files
Merge pull request #89 from jhildenbiddle/vercel-dev-branch-preview
Prevent Vercel deployments from being indexed
2 parents b0d5574 + e622794 commit 9e40e18

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

middleware.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export default async function middleware(request) {
1919

2020
return new Response(previewHTML, {
2121
status: 200,
22-
headers: { 'content-type': 'text/html' },
22+
headers: {
23+
'content-type': 'text/html',
24+
'x-robots-tag': 'noindex'
25+
},
2326
});
2427
}

vercel.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
{
2+
"headers": [
3+
{
4+
"source": "/(.*)",
5+
"headers": [
6+
{ "key": "x-robots-tag", "value": "noindex" }
7+
]
8+
}
9+
],
210
"redirects": [
311
{ "source": "/", "destination": "/preview/" }
412
],
513
"rewrites": [
614
{ "source": "/preview/CHANGELOG.md", "destination": "/CHANGELOG.md" },
715
{ "source": "/preview/:path*", "destination": "/docs/:path*" }
816
]
9-
}
17+
}

0 commit comments

Comments
 (0)