Skip to content

Commit 69ea0b5

Browse files
Add no index edge
Signed-off-by: Christopher Hakkaart <christopher.hakkaart@gmail.com>
1 parent ce6c6dc commit 69ea0b5

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Adds `X-Robots-Tag: noindex` for direct hits to docs-migration.netlify.app,
2+
// while leaving responses unchanged when the request is proxied through
3+
// docs.seqera.io (so the canonical URL is the only one indexed).
4+
//
5+
// Detection relies on the upstream proxy forwarding the original hostname in
6+
// `X-Forwarded-Host`, which nginx, Cloudflare and most CDNs do by default.
7+
8+
export default async (request, context) => {
9+
const response = await context.next();
10+
11+
const forwardedHost = request.headers.get("x-forwarded-host") || "";
12+
const isProxiedFromSeqera = forwardedHost.toLowerCase().includes("seqera.io");
13+
14+
if (!isProxiedFromSeqera) {
15+
response.headers.set("X-Robots-Tag", "noindex");
16+
}
17+
18+
return response;
19+
};
20+
21+
export const config = {
22+
path: "/*",
23+
};

0 commit comments

Comments
 (0)