1. The problem I’m having:
I would like to have a caddy configuration that can work automatically whether it’s behind a local proxy or not.
My reasons for doing this is that this proxy is a work-in-progress, and I sometimes need to take it out of the chain.
The proxy is on the same machine as caddy, has the proper TLS certs, and forwards all requests to caddy.
So the 2 scenarios that I have come up with are:
a) WAN — https —> Caddy
b) WAN — https —> proxy — http —> Caddy
Does this seem like a proper approach, or am I making a mistake?
2. Error messages and/or full log output:
n/a
3. Caddy version:
v2.11.2
4. How I installed and ran Caddy:
a. System environment:
debian trixie bare metal with provided systemd unit file
b. Command:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
c. Service/unit/compose file:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
d. My complete Caddy config:
(redirect_https_unless_local_proxy) {
@not_local not remote_ip 127.0.0.0/8 ::1
redir @not_local https://{host}{uri} permanent
}
http://example.com {
import redirect_https_unless_local_proxy
respond 200
}
https://example.com {
respond 200
}