You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have an issue where I have sites made with Next.js that are served by nginx as a reverse proxy, each one under a different prefix.
The issue I'm encountering is that the redirects that Next.js is applying when removing trailing slashes (I have set trailingSlash: true in my config) get rid of the site prefix ending up in 404s.
In my config i have set trailingSlash: true and assetPrefix: '/abcd', as I can't use basePath because it'd make Next.js files get served under a double prefix for some reason (e.g.: /abcd/abcd). It all works well so far, but when users hit an URL that lacks the trailing slash, the redirect that gets applied removes the site-wide prefix like so: https://my.site/abcd/example-page -> https://my.site/example-page/
This has been reported in several issues before (e.g. this one), and I can't seem to find any solution working in Next.js-land so far. Is there any stable solution that I'm missing, or is it something that could get get fixed by Next.js in the future?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hi, I have an issue where I have sites made with Next.js that are served by
nginx
as a reverse proxy, each one under a different prefix.The issue I'm encountering is that the redirects that Next.js is applying when removing trailing slashes (I have set
trailingSlash: true
in my config) get rid of the site prefix ending up in404
s.In my config i have set
trailingSlash: true
andassetPrefix: '/abcd'
, as I can't usebasePath
because it'd make Next.js files get served under a double prefix for some reason (e.g.:/abcd/abcd
). It all works well so far, but when users hit an URL that lacks the trailing slash, the redirect that gets applied removes the site-wide prefix like so:https://my.site/abcd/example-page
->https://my.site/example-page/
This has been reported in several issues before (e.g. this one), and I can't seem to find any solution working in Next.js-land so far. Is there any stable solution that I'm missing, or is it something that could get get fixed by Next.js in the future?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions