Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): use app.baseURL when fetching error page on server (#8888)
Browse files Browse the repository at this point in the history
Co-authored-by: Toby Faux <tobyfaux@Tobys-MacBook-Pro.local>
  • Loading branch information
tobyfaux and Toby Faux authored Nov 10, 2022
1 parent 52c2bff commit 3e34a61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/nuxt/src/core/runtime/nitro/error.ts
Original file line number Diff line number Diff line change
@@ -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 <NitroErrorHandler> async function errorhandler (error: H3Error, event) {
Expand Down Expand Up @@ -47,7 +47,7 @@ export default <NitroErrorHandler> 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<string, string>,
redirect: 'manual'
}).catch(() => null)
Expand Down

0 comments on commit 3e34a61

Please sign in to comment.