Invalid X-Forwarded-Port for NextJS deployed application

I have created a NextJS application aws-clerk-nextjs-production.up.railway.app. Logging the x-forwarded-port in the console it seems that instead of either a 443,80 or a 443 value we probably get the value of latest node from the route path.
{
origin: null,
host: 'aws-clerk-nextjs-production.up.railway.app',
forwardedPort: '80',
forwardedHost: 'aws-clerk-nextjs-production.up.railway.app',
forwardedProto: 'https,http',
referrer: null,
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36'
}
{
origin: null,
host: 'aws-clerk-nextjs-production.up.railway.app',
forwardedPort: '80',
forwardedHost: 'aws-clerk-nextjs-production.up.railway.app',
forwardedProto: 'https,http',
referrer: null,
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36'
}
The same application deployed in a AWS Amplify Hosting we get both forwardedPort: '443,80', so i guest it's related to how the headers between nodes of the network are propagated and how it's being merged. Is there a more official way to file a bug report? Do you need more details? Is there a guide i should take a look and improve this report?
8 Replies
Percy
Percy•2y ago
Please provide your project ID or reply with N/A. Thread will automatically be closed if no reply is received within 10 minutes. You can copy your project's id by pressing Ctrl/Cmd + K -> Copy Project ID.
Brody
Brody•2y ago
an X-Forwarded-Port simply does not exist https://utilities.up.railway.app/raw
Dimitris | Clerk
Dimitris | ClerkOP•2y ago
@Percy Project ID: dca25c2a-c0e2-4cf2-9d5c-3938efc1def4 Could you please re-open the thread?
Brody
Brody•2y ago
thread doesn't actually get closed fwiw but my answer still stands
Dimitris | Clerk
Dimitris | ClerkOP•2y ago
@brody It may be related to the application/framework. I am using NextJS. How do you retrieve the values from the headers in https://utilities.up.railway.app/raw ? Do you use any framework?
Brody
Brody•2y ago
it's just a display of the raw http request it's just there to demonstrate everything that's available to your app on an incoming request and as you can see, no x-forwarded-port header
Dimitris | Clerk
Dimitris | ClerkOP•2y ago
I will take a better look about how this header is being populated in my case and come back with more information. Thank you for the immediate response and the info 😄
Brody
Brody•2y ago
no problem!
Want results from more Discord servers?
Add your server