1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-06-30 22:05:46 +00:00

fix: Don't create fallback http(s) server when http(s) disabled

Before, a fallback http server was created to handle requests for
unknown virtual hosts even when `HTTPS_METHOD=nohttp`.  (In this case,
all http vhosts would be unknown.)  Likewise, a catch-all fallback
https server was still created even if `HTTPS_METHOD=nohttps`.

Now the fallback servers are created only if needed.  This brings the
behavior in line with the documentation and user expectation.  It will
also make it easier to implement a planned feature: different servers
on different ports.
This commit is contained in:
Richard Hansen
2023-02-04 18:59:38 -05:00
committed by Nicolas Duchon
parent 9297e94389
commit 9b4bb07b34
8 changed files with 194 additions and 50 deletions

View File

@ -1,9 +1,10 @@
import pytest
import requests
def test_web2_http_is_not_forwarded(docker_compose, nginxproxy):
r = nginxproxy.get("http://web2.nginx-proxy.tld/", allow_redirects=False)
assert r.status_code == 503
def test_web2_http_is_connection_refused(docker_compose, nginxproxy):
with pytest.raises(requests.exceptions.RequestException, match="Connection refused"):
nginxproxy.get("http://web2.nginx-proxy.tld/")
def test_web2_https_is_forwarded(docker_compose, nginxproxy):