0

I have a node.js application running on a linux server(nginx).

xxx.xxx.xxx.xxx:3000/api

When I try to connect from my mobile phone or my computer at house I can. But when I try to connect from my company's network I cannot get. Also I can get 80 port from either.

Why I can't get 3000 port?

0

Your company most likely has a firewall that is very restrictive. They will start from the state of nothing allowed and then add what is needed.

These will be things like port 80 for http (Web browsing), 443 for https and anything else you need.

You can set a proxy so that the user connnects on port 80, but your node.js app will still recieve on 3000.

Detailed link here: Here

the TLDR is:

  • Open your config (centOS /etc/nginx/conf.d or Ubuntu /etc/nginx/sites-enabled)
  • Make the changes below (Change as needed to fit your need)
  • Restart your nginx service

    server {
        listen 80;
        server_name your-domain-name.com;
        location / {
           proxy_set_header   X-Real-IP $remote_addr;
           proxy_set_header   Host      $http_host;
           proxy_pass         http://127.0.0.1:3000;
        }
    }
    
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.