Skip to content

Commit 9ffa41a

Browse files
committed
fixup! build
1 parent e01ef8d commit 9ffa41a

File tree

6 files changed

+18
-19
lines changed

6 files changed

+18
-19
lines changed

packages/open-next/src/core/routing/util.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ export function constructNextUrl(baseUrl: string, path: string) {
8989
return url.href;
9090
}
9191

92-
export function extractHostFromHeaders(
93-
headers: Record<string, string>,
94-
): string {
95-
return headers["x-forwarded-host"] ?? headers.host ?? "on";
96-
}
97-
9892
/**
9993
*
10094
* @__PURE__

packages/open-next/src/overrides/converters/aws-apigw-v1.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import type { Converter } from "types/overrides";
44
import { fromReadableStream } from "utils/stream";
55

66
import { debug } from "../../adapters/logger";
7-
import { extractHostFromHeaders } from "../../core/routing/util";
8-
import { removeUndefinedFromQuery } from "./utils";
7+
import { extractHostFromHeaders, removeUndefinedFromQuery } from "./utils";
98

109
function normalizeAPIGatewayProxyEventHeaders(
1110
event: APIGatewayProxyEvent,

packages/open-next/src/overrides/converters/aws-apigw-v2.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ import type { Converter } from "types/overrides";
88
import { fromReadableStream } from "utils/stream";
99

1010
import { debug } from "../../adapters/logger";
11-
import {
12-
convertToQuery,
13-
extractHostFromHeaders,
14-
} from "../../core/routing/util";
15-
import { removeUndefinedFromQuery } from "./utils";
11+
import { convertToQuery } from "../../core/routing/util";
12+
import { extractHostFromHeaders, removeUndefinedFromQuery } from "./utils";
1613

1714
// Not sure which one is really needed as this is not documented anywhere but server actions redirect are not working without this,
1815
// it causes a 500 error from cloudfront itself with a 'x-amzErrortype: InternalFailure' header

packages/open-next/src/overrides/converters/aws-cloudfront.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ import type { Converter } from "types/overrides";
1717
import { fromReadableStream } from "utils/stream";
1818

1919
import { debug } from "../../adapters/logger";
20-
import {
21-
convertToQuery,
22-
convertToQueryString,
23-
extractHostFromHeaders,
24-
} from "../../core/routing/util";
20+
import { convertToQuery, convertToQueryString } from "../../core/routing/util";
21+
import { extractHostFromHeaders } from "./utils";
2522

2623
const cloudfrontBlacklistedHeaders = [
2724
// Disallowed headers, see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-function-restrictions-all.html#function-restrictions-disallowed-headers

packages/open-next/src/overrides/converters/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { IncomingMessage } from "node:http";
33
import { parseCookies } from "http/util";
44
import type { InternalResult } from "types/open-next";
55
import type { Converter } from "types/overrides";
6-
import { extractHostFromHeaders } from "../../core/routing/util";
6+
import { extractHostFromHeaders } from "./utils";
77

88
const converter: Converter = {
99
convertFrom: async (req: IncomingMessage) => {

packages/open-next/src/overrides/converters/utils.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,15 @@ export function removeUndefinedFromQuery(
99
}
1010
return newQuery;
1111
}
12+
13+
/**
14+
* Extract the host from the headers (default to "on")
15+
*
16+
* @param headers
17+
* @returns The host
18+
*/
19+
export function extractHostFromHeaders(
20+
headers: Record<string, string>,
21+
): string {
22+
return headers["x-forwarded-host"] ?? headers.host ?? "on";
23+
}

0 commit comments

Comments
 (0)