Investigate why Next returns an array for some redirects
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.
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?
@donnabelsey added more info on the PR