NGINX Reverse Proxy failing with Linked Docker Containers NGINX Reverse Proxy failing with Linked Docker Containers docker docker

NGINX Reverse Proxy failing with Linked Docker Containers


I was able to figure out the solution and it turned out to be something stupid that didn't show up in any logs and was difficult for me to come across.

Below is the updated nginx.conf file.

worker_processes 4;events { worker_connections 1024; }http {        upstream node_app {        server node1:8080;    }    upstream service_app {        server service1:8383;    }        server {                listen 80;            location / {                proxy_pass http://node_app/;                include /etc/nginx/proxy_params;            }             location /a/ {                proxy_pass http://node_app/;                include /etc/nginx/proxy_params;             }             location /b/ {                proxy_pass http://service_app/;                include /etc/nginx/proxy_params;            }        }}

Not sure if the include is necessary at this point, but the trailing / at the end of the proxy_pass directive seem to do the trick at the end of the day.


I think you should specify the ports within every proxy_pass.

worker_processes 4;events { worker_connections 1024; }http {        server {          listen 80;          location / {            proxy_pass http://node1:8080;          }          location /a/ {            proxy_pass http://node2:8080;          }          location /b/ {            proxy_pass http://service1:8383;          }    }}