Skip to content

Commit ea30ac7

Browse files
authored
(fix): use origin for authed preview urls (#2668)
1 parent 4b56c24 commit ea30ac7

File tree

1 file changed

+4
-1
lines changed
  • packages/fern-docs/bundle/src/app/[host]/[domain]/api/fern-docs/auth/sso/callback

1 file changed

+4
-1
lines changed

packages/fern-docs/bundle/src/app/[host]/[domain]/api/fern-docs/auth/sso/callback/route.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ export async function GET(req: NextRequest): Promise<NextResponse> {
7272
}
7373

7474
// TODO: need to support docs instances with subpaths (forward-proxied from the origin).
75-
const destination = new URL(domain, url.origin);
75+
const destination = new URL(
76+
`${req.nextUrl.pathname}${req.nextUrl.search}`,
77+
url.origin
78+
);
7679
destination.searchParams.set(FORWARDED_HOST_QUERY, req.nextUrl.host);
7780
const allowedDestinations = [withDefaultProtocol(getDocsDomainEdge(req))];
7881

0 commit comments

Comments
 (0)