summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--caddytest/integration/caddyfile_adapt/reverse_proxy_h2c_shorthand.txt17
-rw-r--r--modules/caddyhttp/reverseproxy/addresses.go6
2 files changed, 23 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/reverse_proxy_h2c_shorthand.txt b/caddytest/integration/caddyfile_adapt/reverse_proxy_h2c_shorthand.txt
index 75ce960..5939467 100644
--- a/caddytest/integration/caddyfile_adapt/reverse_proxy_h2c_shorthand.txt
+++ b/caddytest/integration/caddyfile_adapt/reverse_proxy_h2c_shorthand.txt
@@ -1,6 +1,8 @@
:8884
reverse_proxy h2c://localhost:8080
+
+reverse_proxy unix+h2c//run/app.sock
----------
{
"apps": {
@@ -27,6 +29,21 @@ reverse_proxy h2c://localhost:8080
"dial": "localhost:8080"
}
]
+ },
+ {
+ "handler": "reverse_proxy",
+ "transport": {
+ "protocol": "http",
+ "versions": [
+ "h2c",
+ "2"
+ ]
+ },
+ "upstreams": [
+ {
+ "dial": "unix//run/app.sock"
+ }
+ ]
}
]
}
diff --git a/modules/caddyhttp/reverseproxy/addresses.go b/modules/caddyhttp/reverseproxy/addresses.go
index c161ed8..4da47fb 100644
--- a/modules/caddyhttp/reverseproxy/addresses.go
+++ b/modules/caddyhttp/reverseproxy/addresses.go
@@ -96,6 +96,12 @@ func parseUpstreamDialAddress(upstreamAddr string) (string, string, error) {
}
}
+ // special case network to support both unix and h2c at the same time
+ if network == "unix+h2c" {
+ network = "unix"
+ scheme = "h2c"
+ }
+
// for simplest possible config, we only need to include
// the network portion if the user specified one
if network != "" {