How can I remove a port from url for node app using nginx

0 votes

My front end is divided in two parts. Part of it is on react and the other is an angular app. Both are using node/express app on port 3000. I use express-static feature on browser to dynamically handle UI to render react or angular on server.js.

I required it to run using https://example.com (which I handled using "nginx proxy"). But now it's accessible using both https://example.com:3000/ and https:example.com. I want it to be accessed only using https;//example.com without the port.

The server's api can be accessed from the places(https://example.com:3000/api/ver1)

1) ios app 
2) admin app (running differently)
3) and UI(Reactjs+angularjs)  (https://example.com)

Note- We have tried creating a separate node server for UI but that approach will cost us more. Is there any other way to achive this.

Apr 10, 2018 in DevOps on Cloud by Damon Salvatore
• 5,980 points
3,662 views

1 answer to this question.

0 votes

If you run your node server on 0.0.0.0, it becomes accessible globally.

Change yours listening port from:

app.listen(3000)

to

app.listen(3000, '127.0.0.1');

You can also block this port in IPTables as well.

answered Apr 10, 2018 by ajs3033
• 7,300 points

Related Questions In DevOps on Cloud

0 votes
1 answer
0 votes
1 answer

I am looking for a python code to get my Azure VM status in my email , like whether the running vms port is open to the internet. If its open to internet I should get a mail notification

Hey, @Sourav, Check this out https://www.edureka.co/community/66025/azure-vm-monitoring It deals with ...READ MORE

answered May 29, 2020 in DevOps on Cloud by Sirajul
• 59,230 points
1,445 views
0 votes
2 answers
+1 vote
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,503 views
0 votes
1 answer

How to control development/prod/staging application settings using azure functions?

You should use a build-release system like ...READ MORE

answered May 11, 2018 in DevOps on Cloud by ajs3033
• 7,300 points
1,329 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP