Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
cmd: reverse-proxy: add --insecure flag (with warning) (#3389)
linquize committed
May 13, 2020 at 00:43 UTC
44536a7594f060dfca54a3cfb36135c93cba8e59
1 file changed
+5
modules/caddyhttp/reverseproxy/command.go
+5
@@ -59,6 +59,7 @@ default, all incoming headers are passed through unmodified.)
59
fs.String("from", "localhost", "Address on which to receive traffic")
60
fs.String("to", "", "Upstream address to which to to proxy traffic")
61
fs.Bool("change-host-header", false, "Set upstream Host header to address of upstream")
62
+ fs.Bool("insecure", false, "Disable TLS verification (WARNING: DISABLES SECURITY, WHY ARE YOU EVEN USING TLS?)")
63
return fs
64
}(),
65
})
@@ -68,6 +69,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
69
from := fs.String("from")
70
to := fs.String("to")
71
changeHost := fs.Bool("change-host-header")
72
+ insecure := fs.Bool("insecure")
73
74
httpPort := strconv.Itoa(caddyhttp.DefaultHTTPPort)
75
httpsPort := strconv.Itoa(caddyhttp.DefaultHTTPSPort)
@@ -127,6 +129,9 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
129
ht := HTTPTransport{}
130
if toAddr.Scheme == "https" {
131
ht.TLS = new(TLSConfig)
132
+ if insecure {
133
+ ht.TLS.InsecureSkipVerify = true
134
+ }
135
}
136
137
handler := Handler{