I'm trying to run lets-chat inside docker behind nginx acting as a reverse proxy so that lets-chat will be accessible on /chat over HTTP.
In the past when using nginx as a reverse proxy inside of docker for another docker container I set resolver 127.0.0.11 valid=300s; so that nginx uses the docker DNS server and set proxy_pass as a variable so that the nginx container can start without needing the upstream web service to be ready. Example.
However, lets-chat seems to need proxy_redirect default; which the nginx configuration does not allow combined with a variable proxy_pass.
Does anyone know a way around this to get the desired effect? I've tried a few manual redirects with no luck. My relevant nginx config is below.
# use docker's nameserver for changing container IPs resolver 127.0.0.11 valid=300s; resolver_timeout 5s; server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; } location /chat/ { # I would like this part to work #set $chat_backend http://chat_server:8080/; #proxy_pass $chat_backend; # But I can only get it to work like this proxy_pass http://chat_server:8080/; proxy_redirect / /chat/; proxy_redirect default; # this line errors when setting a variable to proxy_pass proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; } } Thanks.