-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1179 from harvdogg/master
Allow complete override of location blocks
- Loading branch information
Showing
13 changed files
with
161 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
def test_explicit_root_nohash(docker_compose, nginxproxy): | ||
r = nginxproxy.get("http://explicit-root-nohash.nginx-proxy.test/port") | ||
assert r.status_code == 418 | ||
r = nginxproxy.get("http://explicit-root-nohash.nginx-proxy.test/foo/port") | ||
assert r.status_code == 200 | ||
assert r.text == "answer from port 82\n" | ||
|
||
def test_explicit_root_hash(docker_compose, nginxproxy): | ||
r = nginxproxy.get("http://explicit-root-hash.nginx-proxy.test/port") | ||
assert r.status_code == 418 | ||
r = nginxproxy.get("http://explicit-root-hash.nginx-proxy.test/foo/port") | ||
assert r.status_code == 200 | ||
assert r.text == "answer from port 82\n" | ||
|
||
def test_explicit_root_hash_and_nohash(docker_compose, nginxproxy): | ||
r = nginxproxy.get("http://explicit-root-hash-and-nohash.nginx-proxy.test/port") | ||
assert r.status_code == 418 | ||
r = nginxproxy.get("http://explicit-root-hash-and-nohash.nginx-proxy.test/foo/port") | ||
assert r.status_code == 200 | ||
assert r.text == "answer from port 82\n" | ||
|
||
def test_explicit_nonroot(docker_compose, nginxproxy): | ||
r = nginxproxy.get("http://explicit-nonroot.nginx-proxy.test/port") | ||
assert r.status_code == 200 | ||
assert r.text == "answer from port 81\n" | ||
r = nginxproxy.get("http://explicit-nonroot.nginx-proxy.test/foo/port") | ||
assert r.status_code == 418 | ||
|
||
def test_implicit_root_nohash(docker_compose, nginxproxy): | ||
r = nginxproxy.get("http://implicit-root-nohash.nginx-proxy.test/port") | ||
assert r.status_code == 418 | ||
|
||
def test_implicit_root_hash(docker_compose, nginxproxy): | ||
r = nginxproxy.get("http://implicit-root-hash.nginx-proxy.test/port") | ||
assert r.status_code == 418 | ||
|
||
def test_implicit_root_hash_and_nohash(docker_compose, nginxproxy): | ||
r = nginxproxy.get("http://implicit-root-hash-and-nohash.nginx-proxy.test/port") | ||
assert r.status_code == 418 |
3 changes: 3 additions & 0 deletions
3
...licit-nonroot.nginx-proxy.test_8d960560c82f4e6c8b1b0f03eb30a1afd00e5696_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
location /foo/ { | ||
return 418; | ||
} |
4 changes: 4 additions & 0 deletions
4
...sh-and-nohash.nginx-proxy.test_42099b4af021e53fd8fd4e056c2568d7c2e3ffa8_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file should trump the file without the hash. | ||
location / { | ||
return 418; | ||
} |
4 changes: 4 additions & 0 deletions
4
...ocation-override.vhost.d/explicit-root-hash-and-nohash.nginx-proxy.test_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# The file with the hash should trump this file. | ||
location / { | ||
return 503; | ||
} |
3 changes: 3 additions & 0 deletions
3
...cit-root-hash.nginx-proxy.test_42099b4af021e53fd8fd4e056c2568d7c2e3ffa8_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
location / { | ||
return 418; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/test_location-override.vhost.d/explicit-root-nohash.nginx-proxy.test_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
location / { | ||
return 418; | ||
} |
4 changes: 4 additions & 0 deletions
4
...sh-and-nohash.nginx-proxy.test_42099b4af021e53fd8fd4e056c2568d7c2e3ffa8_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file should trump the file without the hash. | ||
location / { | ||
return 418; | ||
} |
4 changes: 4 additions & 0 deletions
4
...ocation-override.vhost.d/implicit-root-hash-and-nohash.nginx-proxy.test_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# The file with the hash should trump this file. | ||
location / { | ||
return 503; | ||
} |
3 changes: 3 additions & 0 deletions
3
...cit-root-hash.nginx-proxy.test_42099b4af021e53fd8fd4e056c2568d7c2e3ffa8_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
location / { | ||
return 418; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/test_location-override.vhost.d/implicit-root-nohash.nginx-proxy.test_location_override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
location / { | ||
return 418; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
services: | ||
sut: | ||
image: nginxproxy/nginx-proxy:test | ||
volumes: | ||
- /var/run/docker.sock:/tmp/docker.sock:ro | ||
- ./test_location-override.vhost.d:/etc/nginx/vhost.d:ro | ||
|
||
explicit-root: | ||
image: web | ||
expose: | ||
- "81" | ||
environment: | ||
WEB_PORTS: "81" | ||
VIRTUAL_HOST: >- | ||
explicit-root-nohash.nginx-proxy.test, | ||
explicit-root-hash.nginx-proxy.test, | ||
explicit-root-hash-and-nohash.nginx-proxy.test, | ||
explicit-nonroot.nginx-proxy.test | ||
VIRTUAL_PATH: / | ||
explicit-foo: | ||
image: web | ||
expose: | ||
- "82" | ||
environment: | ||
WEB_PORTS: "82" | ||
VIRTUAL_HOST: >- | ||
explicit-root-nohash.nginx-proxy.test, | ||
explicit-root-hash.nginx-proxy.test, | ||
explicit-root-hash-and-nohash.nginx-proxy.test, | ||
explicit-nonroot.nginx-proxy.test | ||
VIRTUAL_PATH: /foo/ | ||
VIRTUAL_DEST: / | ||
|
||
# Same as explicit-root except VIRTUAL_PATH is left unset. | ||
implicit-root: | ||
image: web | ||
expose: | ||
- "83" | ||
environment: | ||
WEB_PORTS: "83" | ||
VIRTUAL_HOST: >- | ||
implicit-root-nohash.nginx-proxy.test, | ||
implicit-root-hash.nginx-proxy.test, | ||
implicit-root-hash-and-nohash.nginx-proxy.test, |