diff --git a/src/runtime/middleware/auth.ts b/src/runtime/middleware/auth.ts index db4eb8d3..9eda419d 100644 --- a/src/runtime/middleware/auth.ts +++ b/src/runtime/middleware/auth.ts @@ -69,7 +69,7 @@ export default defineNuxtRouteMiddleware((to) => { * - avoid the `Error [ERR_HTTP_HEADERS_SENT]`-error that occurs when we redirect to the sign-in page when the original to-page does not exist. Likely related to https://github.com/nuxt/framework/issues/9438 * */ - if (authConfig.globalAppMiddleware.allow404WithoutAuth) { + if (authConfig.globalAppMiddleware.allow404WithoutAuth || authConfig.globalAppMiddleware === true) { const matchedRoute = to.matched.length > 0 if (!matchedRoute) { // Hands control back to `vue-router`, which will direct to the `404` page diff --git a/src/runtime/utils/url.ts b/src/runtime/utils/url.ts index c4d7b57b..2d2cae44 100644 --- a/src/runtime/utils/url.ts +++ b/src/runtime/utils/url.ts @@ -71,5 +71,7 @@ export const determineCallbackUrl = >(authCon return getOriginalTargetPath() } } + } else if (authConfig.globalAppMiddleware === true) { + return getOriginalTargetPath() } }