File tree Expand file tree Collapse file tree
docs/netlify/edge-functions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ } ;
You can’t perform that action at this time.
0 commit comments