I am using Nuxt.js v2.15 and I am noticing some strange issues regarding the routes. It seems that only certain routes have a trailing slash while others do not. I have even renamed some of the files and the slash went away, but once I renamed the file back to its original name, the slash in the route came back.
I am currently using the router config trailingSlash: false
as well as middleware that redirects to the route without a slash.
When accessing the pages via the Nuxt router, the trailing slash is removed and all looks good. However, once the page is refreshed, the redirect happens and an error shows up. The router continues to try to resolve this and eventually brings me to the page with the trailing slash, but because trailingSlash: false
is set, the page is not working and just shows an error.
I have even taken page files out of folders to put them at the top level of the pages/
directory to see if that would work. It does not.
This is pretty frustrating and it seems that no solution that I have found on the internet, including Stack Overflow, works to fully resolve this issue. I have read what seem to be similar issues here on Stack Overflow that have some suggested solutions. None of them worked to resolve this issue entirely... especially after refreshing the page.
Does anyone know of a solution that works when using Nuxt router AND on a hard refresh?
It's as if the browser itself is forcing the slash while the application is trying to remove the slash.