R
Railway6mo ago
Pepijn

V2 runtime issue when setting port as 443

I just created a new instance with automatically the V2 runtime set and here the builds do not deploy and I get the error message:
Error: listen EACCES: permission denied 0.0.0.0:443
Error: listen EACCES: permission denied 0.0.0.0:443
When I switch the runtime back to Legacy, it works and deploys correctly. If I try to change the port to something else, i.e. 3000, with the V2 runtime the healthcheck does not work. It is a NextJs project.
Solution:
please use a non privileged port. as for the health check failing, there's a bug with the v2 runtime where your app needs to listen on ipv6 to pass a health check, if I'm not mistaken you should be able to set a HOSTNAME variable to :: or change your start script to add a -H :: flag to next start, but I'm not sure if you are using next start so try the variable first...
Jump to solution
15 Replies
Percy
Percy6mo ago
Project ID: a0f3572b-295e-4a43-b776-ce352a4d0980
Pepijn
PepijnOP6mo ago
a0f3572b-295e-4a43-b776-ce352a4d0980
Solution
Brody
Brody6mo ago
please use a non privileged port. as for the health check failing, there's a bug with the v2 runtime where your app needs to listen on ipv6 to pass a health check, if I'm not mistaken you should be able to set a HOSTNAME variable to :: or change your start script to add a -H :: flag to next start, but I'm not sure if you are using next start so try the variable first
Pepijn
PepijnOP6mo ago
Thanks for the info @Brody I used port 443 so the x-forwarded-port would be passed correctly, but now it thinks this is port 3000 So the above solution works, but the I18n plugin I use, checks the x-forwarded-port to apply certain redirects
Pepijn
PepijnOP6mo ago
GitHub
After updating to v3.11.1 rewrite/redirects append a port to the UR...
Description The last change for internal redirecting appends a port to the URL. However in our setup at Railway.app this does a faulty redirect. When the middleware should rewrite / redirect, it ta...
Brody
Brody6mo ago
railway does not set a x-forwarded-port header instead of setting your PORT to 443, this is the correct solution https://github.com/amannn/next-intl/issues/987#issuecomment-2091359239
Pepijn
PepijnOP6mo ago
Hmm okay, hardcoding it for the port can be fine. But the same issue applies also for X-Forwarded-For I would think and then the originating client IP is lost.
Brody
Brody6mo ago
https://utilities.up.railway.app/raw pseudo code if X-Forwarded-Proto == https { X-Forwarded-Port = 443 }
Pepijn
PepijnOP6mo ago
Check, thanks
Linear
Linear6mo ago
Issue PLAT-1415 created.
PLAT-1415 - V2 runtime cannot bind on 443
The V2 runtime seems unable to bind to 443
Status
Triage
Platform
JustJake
JustJake6mo ago
A fix has been rolled out for this
Pepijn
PepijnOP6mo ago
What does the fix entail exactly?
Brody
Brody6mo ago
I assume it would allow you to bind to a non-privileged port given the context of this thread
JustJake
JustJake6mo ago
You can now use port 443
Brody
Brody6mo ago
fwiw I still think binding to a non-privileged port is the more correct option
Want results from more Discord servers?
Add your server