From 7c850c95188bfad2f23c22d1f684d58e086a5463 Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Tue, 5 Nov 2024 14:03:09 -0800 Subject: [PATCH] Work for preview envs --- src/archives/middleware/archived-enterprise-versions.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/archives/middleware/archived-enterprise-versions.ts b/src/archives/middleware/archived-enterprise-versions.ts index 50e241e575b4..d0fbc2d6d5ec 100644 --- a/src/archives/middleware/archived-enterprise-versions.ts +++ b/src/archives/middleware/archived-enterprise-versions.ts @@ -33,8 +33,6 @@ const OLD_DEVELOPER_SITE_CONTAINER = `${OLD_PUBLIC_AZURE_BLOB_URL}/developer-sit // version. E.g. https://github.github.com/docs-ghes-2.10 const ENTERPRISE_GH_PAGES_URL_PREFIX = 'https://github.github.com/docs-ghes-' -const inProd = process.env.NODE_ENV === 'production' // temporary - type ArchivedRedirects = { [url: string]: string | null } @@ -236,7 +234,7 @@ export default async function archivedEnterpriseVersions( ) .replaceAll( `${OLD_AZURE_BLOB_ENTERPRISE_DIR}/${requestedVersion}/`, - `${req.protocol}://${inProd ? 'docs.github.com' : req.get('host')}/enterprise-server@${requestedVersion}/`, + `${req.protocol}://${req.get('x-forwarded-host') || req.get('host')}/enterprise-server@${requestedVersion}/`, ) }