summaryrefslogtreecommitdiff
path: root/caddytest
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-03-25 00:54:03 -0400
committerGitHub <noreply@github.com>2022-03-24 22:54:03 -0600
commita58f240d3ecbb59285303746406cab50217f8d24 (patch)
tree60da8ebee4a81e8ad608b56e8ab81b55101111a4 /caddytest
parent4b75f3e2f09b77b98783ea4d6602391c7283f984 (diff)
httpcaddyfile: Fix #4640 (auto-HTTPS edgecase) (#4661)
Guh, this is complicated. Fixes #4640 This also follows up on #4398 (reverting it) which made a change that technically worked, but was incorrect. It changed the condition in `hostsFromKeysNotHTTP` from `&&` to `||`, but then the function no longer did what its name said it would do, and it would return hosts even if they were marked with `http://`, if they used a non-HTTP port. That wasn't the intent of it. The test added in there was kept though, because it is a valid usecase. The actual fix is to check _earlier_ whether all the addresses explicitly have `http://`, and if so we can short circuit and skip considering the rest.
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/caddyfile_adapt/tls_automation_policies_9.txt56
1 files changed, 56 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/tls_automation_policies_9.txt b/caddytest/integration/caddyfile_adapt/tls_automation_policies_9.txt
new file mode 100644
index 0000000..bd82e96
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/tls_automation_policies_9.txt
@@ -0,0 +1,56 @@
+# example from issue #4640
+http://foo:8447, http://127.0.0.1:8447 {
+ reverse_proxy 127.0.0.1:8080
+}
+----------
+{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":8447"
+ ],
+ "routes": [
+ {
+ "match": [
+ {
+ "host": [
+ "foo",
+ "127.0.0.1"
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "handler": "subroute",
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "reverse_proxy",
+ "upstreams": [
+ {
+ "dial": "127.0.0.1:8080"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "terminal": true
+ }
+ ],
+ "automatic_https": {
+ "skip": [
+ "foo",
+ "127.0.0.1"
+ ]
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file