Skip to content

Commit

Permalink
fix: use right protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Nov 30, 2023
1 parent 0e2ff46 commit 4b3f0dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/edge-functions/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export const initializeProxy = async ({
edge_functions_npm_modules: true,
}
const runtimeFeatureFlags = ['edge_functions_bootstrap_failure_mode', 'edge_functions_bootstrap_populate_environment']
const protocol = settings.https ? 'https' : 'http'

// Initializes the server, bootstrapping the Deno CLI and downloading it from
// the network if needed. We don't want to wait for that to be completed, or
Expand Down Expand Up @@ -184,7 +185,7 @@ export const initializeProxy = async ({
// Setting header with geolocation and site info.
req.headers[headers.Geo] = Buffer.from(JSON.stringify(geoLocation)).toString('base64')
req.headers[headers.DeployID] = '0'
req.headers[headers.Site] = createSiteInfoHeader(siteInfo, `http://localhost:${mainPort}`)
req.headers[headers.Site] = createSiteInfoHeader(siteInfo, `${protocol}://localhost:${mainPort}`)
req.headers[headers.Account] = createAccountInfoHeader({ id: accountId })

if (blobsContext?.edgeURL && blobsContext?.token) {
Expand All @@ -204,7 +205,7 @@ export const initializeProxy = async ({

req[headersSymbol] = {
[headers.FeatureFlags]: getFeatureFlagsHeader(runtimeFeatureFlags),
[headers.ForwardedProtocol]: settings.https ? 'https:' : 'http:',
[headers.ForwardedProtocol]: `${protocol}:`,
[headers.Functions]: functionNames.join(','),
[headers.InvocationMetadata]: getInvocationMetadataHeader(invocationMetadata),
[headers.IP]: LOCAL_HOST,
Expand Down

0 comments on commit 4b3f0dd

Please sign in to comment.