Skip to content

Commit b66d04c

Browse files
authored
v2: fix resolution of revalidation requests (#2926)
1 parent 3173d8e commit b66d04c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/gitbook-v2/src/lib/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
export const GITBOOK_URL =
55
process.env.NODE_ENV === 'development'
66
? 'http://localhost:3000'
7-
: ((process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : undefined) ??
8-
process.env.GITBOOK_URL ??
7+
: (process.env.GITBOOK_URL ??
8+
(process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : undefined) ??
99
'');
1010

1111
/**

packages/gitbook-v2/src/middleware.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ function extractURL(request: NextRequest): URLWithMode | null {
176176
// The x-forwarded-host is set by Vercel for all requests
177177
// so we ignore it if the hostname is the same as the instance one.
178178
if (xForwardedHost && GITBOOK_URL && new URL(GITBOOK_URL).host !== xForwardedHost) {
179+
console.log('xForwardedHost', xForwardedHost, GITBOOK_URL, new URL(GITBOOK_URL).host);
180+
console.log('process.env.VERCEL_URL', process.env.VERCEL_URL);
181+
console.log('process.env.GITBOOK_URL', process.env.GITBOOK_URL);
179182
return {
180183
url: appendQueryParams(
181184
new URL(`https://${xForwardedHost}${request.nextUrl.pathname}`),

0 commit comments

Comments
 (0)