From 3e34a6150683a91bdf1291491e0a2b1b2b79f352 Mon Sep 17 00:00:00 2001 From: Toby Faux Date: Fri, 11 Nov 2022 00:42:55 +1100 Subject: [PATCH] fix(nuxt): use `app.baseURL` when fetching error page on server (#8888) Co-authored-by: Toby Faux --- packages/nuxt/src/core/runtime/nitro/error.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nuxt/src/core/runtime/nitro/error.ts b/packages/nuxt/src/core/runtime/nitro/error.ts index d282491426..cf423894ad 100644 --- a/packages/nuxt/src/core/runtime/nitro/error.ts +++ b/packages/nuxt/src/core/runtime/nitro/error.ts @@ -1,7 +1,7 @@ -import { withQuery } from 'ufo' +import { joinURL, withQuery } from 'ufo' import type { NitroErrorHandler } from 'nitropack' import { H3Error, setResponseHeader, getRequestHeaders } from 'h3' -import { useNitroApp } from '#internal/nitro' +import { useNitroApp, useRuntimeConfig } from '#internal/nitro' import { normalizeError, isJsonRequest } from '#internal/nitro/utils' export default async function errorhandler (error: H3Error, event) { @@ -47,7 +47,7 @@ export default async function errorhandler (error: H3Error, // HTML response (via SSR) const isErrorPage = event.req.url?.startsWith('/__nuxt_error') const res = !isErrorPage - ? await useNitroApp().localFetch(withQuery('/__nuxt_error', errorObject), { + ? await useNitroApp().localFetch(withQuery(joinURL(useRuntimeConfig().app.baseURL, '/__nuxt_error'), errorObject), { headers: getRequestHeaders(event) as Record, redirect: 'manual' }).catch(() => null)