Skip to content

Commit 15fdfee

Browse files
fullstackjamclaude
andcommitted
fix: use absolute URL in alias redirect to fix 500 error
Response.redirect() requires an absolute URL but was given a relative path, causing a TypeError and 500 for browser requests to alias routes like /fullstackjam. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 125143d commit 15fdfee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/hooks.server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ export const handle: Handle = async ({ event, resolve }) => {
7777
}
7878
}));
7979
} else if (isBrowser) {
80-
return withSecurityHeaders(Response.redirect(`/${config.username}/${config.slug}`, 302));
80+
const baseUrl = env.APP_URL || event.url.origin;
81+
return withSecurityHeaders(Response.redirect(`${baseUrl}/${config.username}/${config.slug}`, 302));
8182
}
8283
}
8384
}

0 commit comments

Comments
 (0)