From 200840d55feb0e244b436af26283dadbfa0c0316 Mon Sep 17 00:00:00 2001 From: Vordgi Date: Sun, 1 Feb 2026 13:34:50 +0000 Subject: [PATCH 1/2] fix: configure general rule for trailing slash --- vercel.json | 1 + 1 file changed, 1 insertion(+) diff --git a/vercel.json b/vercel.json index 47cb5701d..602fb126a 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,6 @@ { "$schema": "https://openapi.vercel.sh/vercel.json", + "trailingSlash": false, "redirects": [ { "source": "/", From ea9f89431c1739f7e8a4ccd59d14ca28d5859b03 Mon Sep 17 00:00:00 2001 From: Vordgi Date: Sun, 1 Feb 2026 15:37:46 +0000 Subject: [PATCH 2/2] fix: configure trailing-slash middleware for development --- app/middleware/trailing-slash.global.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/middleware/trailing-slash.global.ts diff --git a/app/middleware/trailing-slash.global.ts b/app/middleware/trailing-slash.global.ts new file mode 100644 index 000000000..f0386e923 --- /dev/null +++ b/app/middleware/trailing-slash.global.ts @@ -0,0 +1,23 @@ +/** + * Removes trailing slashes from URLs. + * + * This middleware only runs in development to maintain consistent behavior. + * In production, Vercel handles this redirect via vercel.json. + * + * - /package/vue/ → /package/vue + * - /docs/getting-started/?query=value → /docs/getting-started?query=value + */ +export default defineNuxtRouteMiddleware(to => { + if (!import.meta.dev) return + + if (to.path !== '/' && to.path.endsWith('/')) { + return navigateTo( + { + path: to.path.slice(0, -1), + query: to.query, + hash: to.hash, + }, + { replace: true }, + ) + } +})