R
Railway11mo ago
Kurdiez

How do you expose a port?

I have a service in Railway that runs a Java server bound to port 5266. I want to expose that publicly so anybody can access the server. So I added the env variable PORT in the settings of that service. But when I do the telnet test to make the TCP/IP connection, nothing is listening on it.
7 Replies
Percy
Percy11mo ago
Project ID: 1f1e865e-cb58-46db-b427-0b47e5dad0c1
Kurdiez
Kurdiez11mo ago
1f1e865e-cb58-46db-b427-0b47e5dad0c1
Brody
Brody11mo ago
you can only expose either a single tcp port or a single http port, with http you can only access the app over https and port 443
Kurdiez
Kurdiez11mo ago
How do I expose the port 443? Do I set the PORT env variable to be 443?
Kurdiez
Kurdiez11mo ago
I did the following - Set the PORT env variable to 443 - Bound the server to port 443 - Go to the browser and tried access one of the GET endpoints, and I get this. Which makes me think probably the server is not exposed correctly.
No description
Kurdiez
Kurdiez11mo ago
The server starts up with SSL properly in localhost. I can access the server with https locally.
Brody
Brody11mo ago
railway automatically generates a PORT environment variable for you, you should not be setting your own, you only need to listen on it. to access your app externally from https you need to be only starting an http server, you cant start an https server, railway handles https for you
Want results from more Discord servers?
Add your server