Query params are lost during static export with trailingSlash enabled.
The issue involves query parameters being dropped when using `next export` with `trailingSlash: true`, particularly when deployed to S3. The behavior differs between localhost and production environments. The fix likely requires understanding both Next.js static export logic and S3 configuration, but the exact scope and solution are not entirely clear.
10.0.5
12.13.0
Brave
macOS
next export -> S3
I have a static site that I am deploying to an S3 bucket with npm run build && npm run export and I have trailingSlash: true set in my next config file.
I am finding that if I go to a route on my localhost like so:
http://localhost:3000/users/login?query=test
then the trailing slash gets inserted and query params passed on:
http://localhost:3000/users/login/?query=test
However I am finding on production that if I go to:
https://test.com/users/login?query=test
I get directed to the following and the query params are lost:
https://test.com/users/login/
I would expect the behaviour to be the same on my localhost and production, and I would expect that the query params are passed along.
Just export any site with npm run build && npm run export and set trailingSlash: true in you next.config.js.
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!