1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-07-01 14:25:46 +00:00

fix: Remove default_server listen option from fallback server

This fixes a bug introduced in commit
9b4bb07b34.
This commit is contained in:
Richard Hansen
2023-04-07 18:05:48 -04:00
parent 1f3508e6df
commit 035bd2b5ac
4 changed files with 37 additions and 4 deletions

View File

@ -0,0 +1,5 @@
server {
server_name __;
listen 80 default_server;
return 418;
}

View File

@ -0,0 +1,14 @@
services:
sut:
image: nginxproxy/nginx-proxy:test
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./custom-fallback.conf:/etc/nginx/conf.d/zzz-custom-fallback.conf:ro
http-only:
image: web
expose:
- "83"
environment:
WEB_PORTS: "83"
VIRTUAL_HOST: http-only.nginx-proxy.test
HTTPS_METHOD: nohttps

View File

@ -89,6 +89,11 @@ CONNECTION_REFUSED_RE = re.compile("Connection refused")
("nohttps-on-app.yml", "https://http-only.nginx-proxy.test/", None, CONNECTION_REFUSED_RE),
("nohttps-on-app.yml", "http://unknown.nginx-proxy.test/", 503, None),
("nohttps-on-app.yml", "https://unknown.nginx-proxy.test/", None, CONNECTION_REFUSED_RE),
# Custom nginx config that has a `server` directive that uses `default_server` and simply
# returns 418. Nginx should successfully start (in particular, the `default_server` in the
# custom config should not conflict with the fallback server generated by nginx-proxy) and nginx
# should prefer that server for handling requests for unknown vhosts.
("custom-fallback.yml", "http://unknown.nginx-proxy.test/", 418, None),
])
def test_fallback(get, url, want_code, want_err_re):
if want_err_re is None: