I have the following nginx config (nginx is hosted in docker as well as a proxied resource):
location /coverage-22.1/ {
resolver 127.0.0.11 valid=30s ipv6=off;
set $url coverage-report-22.1;
proxy_pass http://$url/;
}
I use the $url variable to prevent the error 'host not found in upstream' as its suggested here: docker-nginx-stopped-emerg-11-host-not-found-in-upstream. The coverage-report-22.1
is a name of container in my docker.
This configuration helps to prevent the host not found in upstream
error, but all requested resources (like http://myserver/coverage-22.1/js/site.js
) return content of the index page.
The default configuration works perfectly but nginx fails with the mentioned error if a proxied url is not available:
location /coverage-22.1/ {
proxy_pass http://coverage-report-22.1/;
}