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

fix: server functions x-forwarded-host possible multiple values #73701

Merged
merged 21 commits into from
Jan 3, 2025
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3ea80a0
fix: server functions x-forwarded-host multiple values
Netail Dec 9, 2024
e1dffb4
test: split parseHostHeader and add unit tests
Netail Dec 9, 2024
f44e670
Merge branch 'canary' into fix/server-functions-x-forwarded-host
ijjk Dec 9, 2024
ad549dd
Merge branch 'canary' into fix/server-functions-x-forwarded-host
ijjk Dec 9, 2024
86b2f63
fix: support comma separated string
Netail Dec 9, 2024
5050ff0
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 9, 2024
2cf36e2
Merge branch 'canary' into fix/server-functions-x-forwarded-host
ijjk Dec 10, 2024
6552544
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 10, 2024
e029f05
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 11, 2024
d430125
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 14, 2024
b178077
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 17, 2024
498a20d
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 17, 2024
0092832
fix: support domain with trialing dot
Netail Dec 17, 2024
11471e1
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 19, 2024
645bd76
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 20, 2024
416f658
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 21, 2024
1b20970
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Dec 29, 2024
d20d42f
Merge branch 'canary' into fix/server-functions-x-forwarded-host
Netail Jan 3, 2025
3f5fd34
Merge branch 'canary' into fix/server-functions-x-forwarded-host
ijjk Jan 3, 2025
175bbac
revert this for now
Netail Jan 3, 2025
6bb46ea
Merge branch 'canary' into fix/server-functions-x-forwarded-host
ijjk Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/next/src/server/app-render/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,16 @@ export async function handleAction({
? new URL(req.headers['origin']).host
: undefined

const forwardedHostHeader = req.headers['x-forwarded-host'] as
| string
| undefined
const forwardedHostHeader = req.headers['x-forwarded-host']
const forwardedHostHeaderValue =
forwardedHostHeader && Array.isArray(forwardedHostHeader)
? forwardedHostHeader[0]
: forwardedHostHeader
const hostHeader = req.headers['host']
const host: Host = forwardedHostHeader
const host: Host = forwardedHostHeaderValue
? {
type: HostType.XForwardedHost,
value: forwardedHostHeader,
value: forwardedHostHeaderValue,
}
: hostHeader
? {
Expand Down
Loading