New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nginx-proxy uses default host without DEFAULT_HOST set #1555
Comments
This is the default nginx behavior. When an unknown host is encountered, nginx either picks the If you would like a custom error page, I guess you could add a 'server {}' block with 'default_server' variable set. That could then be customized to return whatever error page you like. See Proxy-Wide Configuration. |
Thanks @tkw1536 for your response. I would call this unexpected behaviour. If DEFAULT_HOST is not set, I would not expect it to be random. If you think this is a feature and not a bug, please feel free to close the issue. |
I am currently toying around with traefik. If the web container for a domain is not present it will automatically respond with a plain 404 instead of an arbitrary site that is listening to a different hostname. Easy use-case: When multiple clients are on one server and a container dies, then I should not show the website of the competition. If there is a DEFAULT_HOST functionality, then nginx-proxy should not just use an arbitrary service when the variable is not defined, but rather respond with a 404 or similar. |
For me this is also a unexpected behaviour. If i update my website and docker down my container, all people will get redirected to my other website. This redirection does stay, even if i up my container again. Or do i miss something? |
For now it seems wise to add a small container serving just a 502 page, set it as 502.yourdomain.com and set it as your DEFAULT_HOST. Since this is the default behavior of nginx, the only way this could really be "fixed" is by making the above process more automated by adding DEFAULT_502 etc. option that will add a default_server which returns 502, and turn it off by default. |
Similar to #992; what I commented there:
|
In case someone by chance ends up having the same issue as I did, I posted my finding/solution at #992 (comment). |
We use nginx-proxy in front of about 25 containers with different sub-domains each.
If a container dies or is stopped, requests are just redirected to a different (other sub-domain) container.
We would rather expect a blank error page. Why is this happening? DEFAULT_HOST is not set.
proxy.conf:
The text was updated successfully, but these errors were encountered: