-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Closed
Labels
RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked
Description
Link to the code that reproduces this issue
https://github.com/yuvalotem1/x-forwarded-port-header--undefined-
To Reproduce
- Create new next application
- Inside pages/api/[...middleware].ts add this function -
export default function apiMiddleware(req: NextApiRequest) {
//this will log 'undefined'
console.log('x-forwarded-port ', req.headers['x-forwarded-port ']);
} - deploy to vercel
- check the logs and see x-forwarded-port log
Current vs. Expected behavior
Expected behavior to not have the header/to have 80/443 as the default value
using http-proxy with api-router crashes because invalid x-forwarded-port header value 'undefined'
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000
Binaries:
Node: 18.18.0
npm: 9.8.1
Yarn: 1.22.19
pnpm: N/A
Relevant Packages:
next: 14.1.1-canary.10 // Latest available version is detected (14.1.1-canary.10).
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Middleware / Edge (API routes, runtime)
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
No response
AtaliaRefua, frontegg-david, mariavlasov, MaxArnautFrontegg, raz-shlomo-frontegg and 6 more
Metadata
Metadata
Assignees
Labels
RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.locked