Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/start/src/server/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export function createBaseHandler(
middleware: middleware.length ? middleware.map(decorateMiddleware): undefined,
handler: decorateHandler(async (e: H3Event) => {
const event = getRequestEvent()!;
const url = new URL(event.request.url);
const pathname = url.pathname;
const pathname = e.url.pathname;

const serverFunctionTest = join(import.meta.env.BASE_URL, SERVER_FN_BASE);
if (pathname.startsWith(serverFunctionTest)) {
Expand Down
4 changes: 4 additions & 0 deletions packages/start/src/server/server-functions-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export async function handleServerFunction(h3Event: H3Event) {
const serverReference = request.headers.get("X-Server-Id");
const instance = request.headers.get("X-Server-Instance");
const singleFlight = request.headers.has("X-Single-Flight");
const url = h3Event.url;
let functionId: string | undefined | null, name: string | undefined | null;
const url = new URL(request.url);
let functionId: string | undefined | null;
if (serverReference) {
Expand Down Expand Up @@ -317,6 +319,8 @@ async function handleSingleFlight(
if (result.headers.has("Location"))
url = new URL(
result.headers.get("Location")!,
sourceEvent.nativeEvent.url.origin +
import.meta.env.SERVER_BASE_URL,
new URL(sourceEvent.request.url).origin +
import.meta.env.BASE_URL,
).toString();
Expand Down
Loading