On which port does glitch open?

Hi, I’m trying to host a mod mail bot and it gives a log of the history via a IP:Port site. I tried on 3000 and 8080 port but the site won’t load up. Any solution?

Hi @Infinity1231, Glitch projects typically open port 3000 (although this can change under some circumstances - in Node, process.env.PORT always represents the right one unless you’ve overridden that variable in .env). If you can provide your project name we can try to offer specific help.

Hey @cori, the project name is dragory-modmailbot-27

Thanks for the info. I’m very much not sure what’s supposed to be happening here, but I do see that you have port 8890 configured in your config file, and if I go to the project’s console and type curl localhost:8890 I get a response of “Page Not Found”. So that tells me that something is listening on port 8890 locally. What do you see when you try to use 3000 there?

If I change the port to 3000 and try to visit the website, it still doesn’t load up, I tried both 3000 and 8080. I am not sure what’s the problem
Running curl localhost:3000 returns this:
curl: (7) failed to connect to localhost
port 3000: connection refused

On a Remix of your project if I change https://glitch.com/edit/#!/dragory-modmailbot-27?path=src/config.js:91:0 to read 3000 and then manually trigger a restart (since you have a long throttle in your watch.json file), curl localhost:3000 from the console returns Page Not Found as does the project’s public address, so I think that gets your project’s page running as expected. Why it can’t find the page is unrelated to the port, I think.

Hope this helps!

So nothing can be done?

I’m not saying that at all. If you change the port to 3000 in your config and force your project to restart (editing package.json by adding and deleting a character somewhere should suffice) should get your project serving whatever page is available to serve. From there you’ll need to figure out why your project can’t find the page it’s expecting, but that’s not a problem with Glitch.

Ok I changed the port to 3000 and refreshed using the console but still the logs website isn’t working. Here’s the website that the bot gave: http://52.70.126.153:3000/logs/bdf3edd4-497d-4c1d-85a7-df80df7421bb

https://dragory-modmailbot-27.glitch.me/logs/bdf3edd4-497d-4c1d-85a7-df80df7421bb shows content, though.

I’d caution that you should make sure none of the information provided there should be kept private before exposing this to the internet without some sort of authentication in front of it.

I knew that it did not contain any such private information and so I posted it publically but thanks for your advice. And also thank you, I can now change a bit of the code and manage to get my logs working!

1 Like