mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 01:38:15 +00:00
test: Add test to cover SSL of path-based routing
This commit is contained in:
parent
12887a977b
commit
e08b3487c9
15
test/test_ssl/test_virtual_path.py
Normal file
15
test/test_ssl/test_virtual_path.py
Normal file
@ -0,0 +1,15 @@
|
||||
import pytest
|
||||
|
||||
@pytest.mark.parametrize("path", ["web1", "web2"])
|
||||
def test_web1_http_redirects_to_https(docker_compose, nginxproxy, path):
|
||||
r = nginxproxy.get("http://www.nginx-proxy.tld/%s/port" % path, allow_redirects=False)
|
||||
assert r.status_code == 301
|
||||
assert "Location" in r.headers
|
||||
assert "https://www.nginx-proxy.tld/%s/port" % path == r.headers['Location']
|
||||
|
||||
@pytest.mark.parametrize("path,port", [("web1", 81), ("web2", 82)])
|
||||
def test_web1_https_is_forwarded(docker_compose, nginxproxy, path, port):
|
||||
r = nginxproxy.get("https://www.nginx-proxy.tld/%s/port" % path, allow_redirects=False)
|
||||
assert r.status_code == 200
|
||||
assert "answer from port %d\n" % port in r.text
|
||||
|
27
test/test_ssl/test_virtual_path.yml
Normal file
27
test/test_ssl/test_virtual_path.yml
Normal file
@ -0,0 +1,27 @@
|
||||
web1:
|
||||
image: web
|
||||
expose:
|
||||
- "81"
|
||||
environment:
|
||||
WEB_PORTS: "81"
|
||||
VIRTUAL_HOST: "www.nginx-proxy.tld"
|
||||
VIRTUAL_PATH: "/web1/"
|
||||
VIRTUAL_DEST: "/"
|
||||
|
||||
web2:
|
||||
image: web
|
||||
expose:
|
||||
- "82"
|
||||
environment:
|
||||
WEB_PORTS: "82"
|
||||
VIRTUAL_HOST: "www.nginx-proxy.tld"
|
||||
VIRTUAL_PATH: "/web2/"
|
||||
VIRTUAL_DEST: "/"
|
||||
|
||||
sut:
|
||||
image: nginxproxy/nginx-proxy:test
|
||||
volumes:
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
- ../lib/ssl/dhparam.pem:/etc/nginx/dhparam/dhparam.pem:ro
|
||||
- ./certs:/etc/nginx/certs:ro
|
||||
|
Loading…
x
Reference in New Issue
Block a user