Nodejs fail to listen port with ip address

Problem: a server behind proxy unreachable for api listening port 3050 with bedrock wordpress.

I had deployed wordpress with Trellis to my VMs. Everything is up and running perfectly. The wordpress site is accessible to the example.com but it won’t able access through IP address like 192.168.1.157

I had setup a node api that listening on port 3050. but when I try to browse/curl it with 192.168.1.157:3050 or 192.168.1.157/api

Chrome is return: This site can’t be reached ; ERR_CONNECTION_REFUSED

I only able to reach the site with example.com/api

I have a Nginx reverse proxy that help me route to my Proxmox VMs.

Here is the routing rules that written on my revesed proxy:

location ~* /api/ {
    client_max_body_size 500M;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto http;
    rewrite ^/api/(.*) /$1 break;
    proxy_pass http://192.168.1.157:3050;
}

Normally the node api should be reachable like:
screenshot: http://goo.gl/flh2OE
but now:
screenshot: http://goo.gl/0pNpi7

I am looking for a way, that my Trellis Wordpress can be access with 192.168.1.157 . I think it will help me solve the problem.

Any advise are appreciated

Thanks

Trellis does not currently support using an IP address for virtual hosts, only hostnames.

1 Like

Thanks for the reply :slight_smile:

Is there any chance I can manually override it from the server?

if yes, where are the conf located?

if disallow access it with IP address doesn’t matter

if there any chance to open a custom port of the server?

It works with localhost

$ curl localhost:3061/api {"api":true}%

But external failed me

$ curl example.com:3061 curl: (7) Failed to connect to example.com port 3061: Connection refused

Thanks, I had found the solution

What was the solution you used?