Why can't I connect to "myapp.me:3000"?

Hi there,

I’m new to Glitch, but not so new with Node.js and programming in general. But breifly, I was messing around with the sample app created by Glitch and noticed something I found weird.

The app is simply an express app that creates a web server to show a webpage. However, the part that got my attention is that the port being used (as logged by the Glitch logger) is port 3000 (Express method: app.listen(3000) ).

My question is:
I’ve used Express locally in my computer and created lots of development servers and, as many of you surely know, you connect to that server via localhost:3000 or whatever is your chosen port. My surprise was that I could connect to my Glich app via the provided host without specifying a port, what means it is using the default HTTP or HTTPS port, 80 or 443, and, that I could not connect to the host with the port 3000 host:3000.

I noticed I cound not either specify any other port to use.

Is that just a portfowarding used by Glitch?

If I wanted to created a server on another port for any reasion, how would I do it?

Thank you very much for the help!
I know it’s a very specific question but it really bothers me to do not fully understand what is happening in the background.

Glitch takes port 3000 on your domain and forwards it to port 80 on <subdomain>.glitch.me so your users don’t have to add an extra port to the url. If you need multiple ports, use nginx.

2 Likes

*and port 443

Yes, for SSL.

TLS that is

Thanks for that! Appreciated

2 Likes