Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 15:30 UTC
reverseproxy: Add `unix+h2c` Caddyfile network shortcut (#4953)
Francis Lavoie committed
Aug 12, 2022 at 17:09 UTC
e2a5e2293ab0b06e33445a1243f36cd5def1de42
2 files changed
+23
caddytest/integration/caddyfile_adapt/reverse_proxy_h2c_shorthand.txt
+17
@@ -1,6 +1,8 @@
1
:8884
2
3
reverse_proxy h2c://localhost:8080
4
+
5
+reverse_proxy unix+h2c//run/app.sock
6
----------
7
{
8
"apps": {
@@ -27,6 +29,21 @@ reverse_proxy h2c://localhost:8080
29
"dial": "localhost:8080"
30
}
31
]
32
+ },
33
+ {
34
+ "handler": "reverse_proxy",
35
+ "transport": {
36
+ "protocol": "http",
37
+ "versions": [
38
+ "h2c",
39
+ "2"
40
+ ]
41
+ },
42
+ "upstreams": [
43
+ {
44
+ "dial": "unix//run/app.sock"
45
+ }
46
+ ]
47
}
48
]
49
}
modules/caddyhttp/reverseproxy/addresses.go
+6
@@ -96,6 +96,12 @@ func parseUpstreamDialAddress(upstreamAddr string) (string, string, error) {
96
}
97
}
98
99
+ // special case network to support both unix and h2c at the same time
100
+ if network == "unix+h2c" {
101
+ network = "unix"
102
+ scheme = "h2c"
103
+ }
104
+
105
// for simplest possible config, we only need to include
106
// the network portion if the user specified one
107
if network != "" {