open-next icon indicating copy to clipboard operation
open-next copied to clipboard

Redirect loop with trailing slashes appended to end of query string

Open leanderiversen opened this issue 3 years ago • 7 comments

Hi,

I have encountered an issue that causes a redirect loop, and can confirm that it works as expected locally.

Given the following URL, https://www.example.com/example?query=example, I would expect it to redirect to https://www.example.com/example/?query=example when trailingSlash is enabled in next.config.js.

However, a redirect loop occurs, and trailing slashes gets appended to the end of the query string, like this: https://www.example.com/example?query=example////////////////////////////////////.

Versions Next: 13.4.17 (app directory) SST: 2.29.2 OpenNext: 2.2.3

Happy to provide more details if needed.

Thank you!

leanderiversen avatar Oct 17 '23 15:10 leanderiversen

Should be fixed in the upcoming 2.2.4

khuezy avatar Oct 17 '23 16:10 khuezy

@khuezy Great, thank you very much!

leanderiversen avatar Oct 17 '23 16:10 leanderiversen

@leanderiversen can you try 2.2.4 to see if it's fixed.

khuezy avatar Oct 17 '23 17:10 khuezy

@khuezy I'm using open-next as part of SST, so I'm restricted to the latest bundled version, unless there is a way of overriding it.

leanderiversen avatar Oct 17 '23 17:10 leanderiversen

you can override the buildCommand on NextjsSite, npx [email protected] build

khuezy avatar Oct 17 '23 17:10 khuezy

@khuezy I can confirm that the issue has been fixed. Thank you!

leanderiversen avatar Oct 17 '23 17:10 leanderiversen

Fixed in 2.2.4

khuezy avatar Oct 17 '23 17:10 khuezy