1. The problem I’m having:
I have a simple reverse proxy to the app that is stubborn enough to ignore all proxy-related requests so it generates redirects with “http://…” in the Location header. I can’t do anything obout it so I’m trying to replace http with https in the response header through Caddy.
header (Caddyfile directive) — Caddy Documentation docs says that it is possible to replace http with https with simple directive:
Replace http:// with https:// in any Location header:
header Location http:// https://
But it doesn’t have any effect in my case, Location header still have http instead of https and it looks like this directive is doing nothing. To be sure I added a new header and it is present in my response.
2. Error messages and/or full log output:
3. Caddy version:
2.8.4
4. How I installed and ran Caddy:
My caddy is running in Docker (custom Dockerfile)
a. System environment
docker
b. Command:
not important
c. Service/unit/compose file:
not important
d. My complete Caddy config:
{
auto_https disable_certs # i'm using certs from static files
admin off
}
*.mydomain.com {
tls /etc/caddy/public.pem /etc/caddy/private.key {
protocols tls1.2 tls1.3
client_auth verify_if_given
}
handle /app* {
reverse_proxy my-app.address.local:2222 {
@redirect 301 302 303 307 308
handle_response @redirect {
header Custom-Header "Test"
header Location http:// https://
# also tried like:
# header Location http https
# or any other text in the location header - no effect
copy_response # i'm not getting any response without this directive
}
}
}
}