Sometimes you need to reverse proxy to an insecure endpoint. Here’s a snippet that does this in a Caddyfile.

(reverse_proxy_insecure) {
        reverse_proxy * {
                to {args.0}
                transport http {
                        tls
                        tls_insecure_skip_verify
                        read_buffer 8192
                }
        }
}

Here’s how to use it.

mysite.com {
	import reverse_proxy_insecure https://localhost:8443
}