From bf0b464c0d4498ab08edbdab6b3bb3af4ea173ad Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Tue, 12 Nov 2024 17:50:54 -0500 Subject: [PATCH] fix: update url generation for fastify v5 (#458) * Update server.ts * chore: support fastify v4 and v5 * Update server.ts * Update server.ts Signed-off-by: Logan McAnsh * Create little-zebras-admire.md Signed-off-by: Logan McAnsh --------- Signed-off-by: Logan McAnsh --- .changeset/little-zebras-admire.md | 5 +++++ packages/remix-fastify/src/server.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/little-zebras-admire.md diff --git a/.changeset/little-zebras-admire.md b/.changeset/little-zebras-admire.md new file mode 100644 index 00000000..38dd3f42 --- /dev/null +++ b/.changeset/little-zebras-admire.md @@ -0,0 +1,5 @@ +--- +"@mcansh/remix-fastify": patch +--- + +fix: update url generation for fastify v5 diff --git a/packages/remix-fastify/src/server.ts b/packages/remix-fastify/src/server.ts index 1506c108..3b900faa 100644 --- a/packages/remix-fastify/src/server.ts +++ b/packages/remix-fastify/src/server.ts @@ -88,7 +88,7 @@ export function createRemixHeaders( export function getUrl( request: FastifyRequest, ): string { - let origin = `${request.protocol}://${request.hostname}`; + let origin = `${request.protocol}://${request.host}`; // Use `request.originalUrl` so Remix is aware of the full path let url = `${origin}${request.originalUrl}`; return url;