Does glitch sup*port* ports

#1

im sorry for the pun XD

im running a server on a game called arras and i have all this stuff but for some reason it only works when no port is put in (how i put port # is by adding a : then the port like this: :port) and when it does have no port as far as ive tested it always looks in port 8080 so is there a way i can READ a port not just send stuff to it https://glitch.com/edit/#!/stuffystuff

#2

Hey @geoffrey1900 this depends on what you mean by “read” a port. Glitch only opens one port to the outside world (generally 3000, but sometimes it changes, for example if you’re using the Debugger; Node’s process.env.PORT always has the correct one unless you’ve overridden it in .env).

So if you’re looking to have port 8080, for instance, be accessible to services outside of your project, you won’t be able to do that.

If that’s not what you’re asking about can you help me understand what you do mean?

#3

well thats kinda what im asking im just asking if theres a way to open 2 ports and i dont care what they are and if you cant then thad be annoying but would there be a workaround?

#4

Glitch only lets you have one open port currently and that’s port 3000 (as of writing this).

However, when you access your project Glitch turns port 3000 into port 8080 (i think?).

In other words, just enter your project URL without the port into the game.


EDIT: Accidentally pressed Post whilst mid-typing.

#5

@geoffrey1900 things are a little more complicated than what @xXProGamerXx describes, but the essence is correct. There are a few layers that a request to a specific Glitch url goes through, but basically a request comes in for port 80 or 443 (depending on whether HTTP or HTTPS) and it gets forwarded through our infrastructure and eventually ends up at port 3000 (usually) in your project’s container. We do only open a single port, but you could try something like what’s discussed in What's the port range users have at Glitch? to forward other internal ports.

Basically. you can open any port you’re able to access within the project container (since you’re not root that’s basically anything over 1024), but none of them will get traffic from outside the container (i.e. the internet) - that will only come into the single port that’s open.