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

Investigate why Next returns an array for some redirects

Open sommeeeer opened this issue 2 months ago • 2 comments

https://github.com/opennextjs/opennextjs-aws/pull/1016#issuecomment-3407588117

We should investigate why this is happening, and what those elements correspond to. If they are not the same we need to dig deeper for the cause.

This can happen if you have a redirect() in a page and you don't have a cacheHandler configured (or that get returns null). Next then gives you a Location which is an array of two elements that from my testing was the same. (i.e: Location: ["/target", "/target"];).

However, we thought we took care of this problem in this PR. It turns out there might be more cases where Next returns an array for the Location header. We need to identify all such cases and ensure we're selecting the correct value.

sommeeeer avatar Oct 15 '25 17:10 sommeeeer

In some cases it can return an array with one element. With a recent PR it takes care of that problem. However, are there any cases it can return a Location header with multiple elements that are not equal?

sommeeeer avatar Oct 15 '25 18:10 sommeeeer

@donnabelsey added more info on the PR

vicb avatar Oct 16 '25 13:10 vicb