I'm using NGINX in a simple reverse proxy scenario, usually with a variable to define host names so that it won't fail to start if the host is unavailable.
Here's what I find:
With this configuration traffic is proxied, but the pages don't render completely - it looks as if some of the .js libraries aren't loading.
resolver 192.168.86.1 valid=30s ipv6=off;
location /cam/ {
set $motion01 motion01;
proxy_set_header Host $host;
proxy_pass http://$motion01.lan/;
If I remove the ipv6=off like this, then I get 502 bad gateway, and the error shows "host not resolved":
resolver 192.168.86.1 valid=30s;
location /cam/ {
set $motion01 motion01;
proxy_set_header Host $host;
proxy_pass http://$motion01.lan/;
But, if I change to use a literal host name rather than a variable, it works perfectly:
set $motion01 motion01;
proxy_set_header Host $host;
#proxy_pass http://$motion01.lan/;
proxy_pass http://motion01.lan/;
I don't want to use a literal host name as nginx won't start if the host isn't available at startup time, but I can't figure out what is up with this configuration.
I've tried with IP6 enabled and disabled on the server, and with including and excluding the
listen [::]:443 ssl;
directive, all to no avail. This wasn't an issue with the earlier version of nginx (can't remember which I originally used), but is now with 1.14.2.2.
Any and all suggestions welcome!