Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicating location header #368

Closed
r34son opened this issue Feb 25, 2024 · 3 comments · Fixed by #369
Closed

Duplicating location header #368

r34son opened this issue Feb 25, 2024 · 3 comments · Fixed by #369

Comments

@r34son
Copy link
Contributor

r34son commented Feb 25, 2024

I'm using next-intl. Server function handles redirect from middleware, but there is an issue that it duplicates location header because of case mismatch.

"headers": {
    "location": "https://someurl.com/some-path",
    "Location": "https://someurl.com/some-path"
},
@r34son
Copy link
Contributor Author

r34son commented Feb 25, 2024

https://github.com/sst/open-next/blob/3deb2022d0bb506e4c4b66baeae248c7c2b153e5/packages/open-next/src/adapters/routing/middleware.ts#L125-L140

Here resHeaders contain location key. It's strange that you get location header and assign it to Location key.
I can open a PR that fixes this behavior, if you approve that it's real issue.

@khuezy
Copy link
Contributor

khuezy commented Feb 26, 2024

Clients and servers are suppose to handle either casing right? But in general, they should be pascal casing. Can you figure out where/what is setting it to the lower case location and fix that? If that's somewhere upstream, then we should delete it from the resHeaders to remove the duplication.

@r34son
Copy link
Contributor Author

r34son commented Feb 26, 2024

It breaks app, because by design 2 same http headers are combined in one, values in which are separated by commas. https://www.rfc-editor.org/rfc/rfc9110.html#name-field-lines-and-combined-fi

Also realised that header names are lowercase in https://developer.mozilla.org/en-US/docs/Web/API/Headers
image

I'll open pr that changes Location to location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants