Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

502 Bad Gateway - NGINX no resolver defined to resolve

I have created a proxy pass for multi URLs.

    listen 80;
    listen [::]:80;

    server_name ~^(.*)redzilla\.11\.75\.65\.21\.xip\.io$;

            location / {
                    set $instname $1;
                    proxy_pass http://${instname}redzilla.localhost:3000;
            }

When I call to this service using chrome, It was triggered 502 error.

http://test.redzilla.11.75.65.21.xip.io/

I put below location tag by hard coding the URL.

            location /redzilla {
                    proxy_pass http://test.redzilla.localhost:3000;
            }

Then It is working for only above URL. I want to know how to create proxy pass for multiple URL within single location tag. ( please note : URL pattern is *.redzilla.localhost:3000 , * ( star ) represent any word)

like image 237
Stelan Briyan Simonsz Avatar asked Sep 14 '19 16:09

Stelan Briyan Simonsz


1 Answers

If you are using nginx inside docker, define a network, using docker network create .... Containers that are part of that network (through the --network flag on docker run), will have a dns resolver added to them, available via 127.0.0.11.

Then in your server {} directive add "resolver 127.0.0.11;"

like image 96
snez Avatar answered Sep 21 '22 14:09

snez