mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-07-01 06:15:45 +00:00
feat: ENABLE_HTTP_ON_MISSING_CERT variable
Default: true
This commit is contained in:
18
test/test_enable_http_on_missing_cert.py
Normal file
18
test/test_enable_http_on_missing_cert.py
Normal file
@ -0,0 +1,18 @@
|
||||
import pytest
|
||||
|
||||
|
||||
def test_nohttp_missing_cert_disabled(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://nohttp-missing-cert-disabled.nginx-proxy.tld/", allow_redirects=False)
|
||||
assert r.status_code == 503
|
||||
|
||||
def test_nohttp_missing_cert_enabled(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://nohttp-missing-cert-enabled.nginx-proxy.tld/", allow_redirects=False)
|
||||
assert r.status_code == 200
|
||||
|
||||
def test_redirect_missing_cert_disabled(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://redirect-missing-cert-disabled.nginx-proxy.tld/", allow_redirects=False)
|
||||
assert r.status_code == 301
|
||||
|
||||
def test_redirect_missing_cert_enabled(docker_compose, nginxproxy):
|
||||
r = nginxproxy.get("http://redirect-missing-cert-enabled.nginx-proxy.tld/", allow_redirects=False)
|
||||
assert r.status_code == 200
|
46
test/test_enable_http_on_missing_cert.yml
Normal file
46
test/test_enable_http_on_missing_cert.yml
Normal file
@ -0,0 +1,46 @@
|
||||
version: "2"
|
||||
|
||||
services:
|
||||
sut:
|
||||
image: nginxproxy/nginx-proxy:test
|
||||
volumes:
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
- ./withdefault.certs:/etc/nginx/certs:ro
|
||||
environment:
|
||||
ENABLE_HTTP_ON_MISSING_CERT: "false"
|
||||
|
||||
nohttp-missing-cert-disabled:
|
||||
image: web
|
||||
expose:
|
||||
- "81"
|
||||
environment:
|
||||
WEB_PORTS: "81"
|
||||
VIRTUAL_HOST: nohttp-missing-cert-disabled.nginx-proxy.tld
|
||||
HTTPS_METHOD: nohttp
|
||||
|
||||
nohttp-missing-cert-enabled:
|
||||
image: web
|
||||
expose:
|
||||
- "82"
|
||||
environment:
|
||||
WEB_PORTS: "82"
|
||||
VIRTUAL_HOST: nohttp-missing-cert-enabled.nginx-proxy.tld
|
||||
HTTPS_METHOD: nohttp
|
||||
ENABLE_HTTP_ON_MISSING_CERT: "true"
|
||||
|
||||
redirect-missing-cert-disabled:
|
||||
image: web
|
||||
expose:
|
||||
- "83"
|
||||
environment:
|
||||
WEB_PORTS: "83"
|
||||
VIRTUAL_HOST: redirect-missing-cert-disabled.nginx-proxy.tld
|
||||
|
||||
redirect-missing-cert-enabled:
|
||||
image: web
|
||||
expose:
|
||||
- "84"
|
||||
environment:
|
||||
WEB_PORTS: "84"
|
||||
VIRTUAL_HOST: redirect-missing-cert-enabled.nginx-proxy.tld
|
||||
ENABLE_HTTP_ON_MISSING_CERT: "true"
|
Reference in New Issue
Block a user