summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy
diff options
context:
space:
mode:
authorY.Horie <u5.horie@gmail.com>2023-01-25 23:40:08 +0900
committerGitHub <noreply@github.com>2023-01-25 09:40:08 -0500
commite9d95ab29f6cbf24fd3f7f7fd439ab31e2797f93 (patch)
treee054e0cc5cc41549d1d8fe5ab78662700d5626b7 /modules/caddyhttp/reverseproxy
parent962310204f088a74719a48fa2dc76e76934dfa09 (diff)
reverseproxy: Add flag to short command to disable redirects (#5330)
Co-authored-by: Francis Lavoie <lavofr@gmail.com> Fixes undefined
Diffstat (limited to 'modules/caddyhttp/reverseproxy')
-rw-r--r--modules/caddyhttp/reverseproxy/command.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/caddyhttp/reverseproxy/command.go b/modules/caddyhttp/reverseproxy/command.go
index ca62191..44f4c22 100644
--- a/modules/caddyhttp/reverseproxy/command.go
+++ b/modules/caddyhttp/reverseproxy/command.go
@@ -64,6 +64,7 @@ default, all incoming headers are passed through unmodified.)
fs.Bool("insecure", false, "Disable TLS verification (WARNING: DISABLES SECURITY BY NOT VERIFYING SSL CERTIFICATES!)")
fs.Bool("internal-certs", false, "Use internal CA for issuing certs")
fs.Bool("debug", false, "Enable verbose debug logs")
+ fs.Bool("disable-redirects", false, "Disable HTTP->HTTPS redirects")
return fs
}(),
})
@@ -77,6 +78,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
insecure := fs.Bool("insecure")
internalCerts := fs.Bool("internal-certs")
debug := fs.Bool("debug")
+ disableRedir := fs.Bool("disable-redirects")
httpPort := strconv.Itoa(caddyhttp.DefaultHTTPPort)
httpsPort := strconv.Itoa(caddyhttp.DefaultHTTPSPort)
@@ -174,6 +176,8 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
if fromAddr.Scheme == "http" {
server.AutoHTTPS = &caddyhttp.AutoHTTPSConfig{Disabled: true}
+ } else if disableRedir {
+ server.AutoHTTPS = &caddyhttp.AutoHTTPSConfig{DisableRedir: true}
}
httpApp := caddyhttp.App{