Home > Mobile >  How can I remove the port from the url?
How can I remove the port from the url?

Time:03-18

I want to hide my port number in NodeJS, for example:- I was running on a port 4001,if I want to make a request for '/xyz' webhook I need to make a request as 'https://example.com:4001/xyz' in this I am not interested to show my PORT to others I want to mask or hide it from the public it should be as "https://example.com/xyz" Please help me to setup as above

CodePudding user response:

I'm assuming your using localhost to serve your app. Once you deploy to the web, the port number will be handled automatically as all http requests are routed to port 80 by default.

CodePudding user response:

May be you have given port number in your code. just remove that, instead keep process.env.PORT or process.env.PORT || 4001. so that the server will take port 80 by default. now you no need to add the port number while visiting the url.

  • Related