From 4c4234135c7c72d05de1ada33703555203f399fa Mon Sep 17 00:00:00 2001 From: Davide <43080019+edivados@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:17:44 +0100 Subject: [PATCH] an even better fix for #1165 --- packages/start/server/middleware.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/start/server/middleware.ts b/packages/start/server/middleware.ts index bb05c3ca4..d81122668 100644 --- a/packages/start/server/middleware.ts +++ b/packages/start/server/middleware.ts @@ -2,6 +2,7 @@ import { defineMiddleware, EventHandlerRequest, getRequestIP, + getRequestURL, H3Event, sendWebResponse, toWebRequest @@ -18,9 +19,13 @@ const eventTraps = { }; export function createFetchEvent(event: H3Event): FetchEvent { + event.web ??= event.web = event.web || { + url: getRequestURL(event), + request: toWebRequest(event) + }; return new Proxy( { - request: toWebRequest(event), + request: event.web.request, clientAddress: getRequestIP(event), locals: {}, // @ts-ignore