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,510 points
543 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,280 points

Related Questions In DevOps on Cloud

0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

Can i include custom data in a AWS cloudwatch alarm

You would have routied the alert event ...READ MORE

answered Aug 2, 2018 in DevOps on Cloud by Kalgi
• 41,660 points
48 views
0 votes
1 answer
0 votes
1 answer
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
180 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 10, 2018 in DevOps on Cloud by ajs3033
• 7,280 points
300 views
0 votes
1 answer