Hello, I’m reverse proxying an external site and it’s working fine except when I access it without a trailing slash: /forums results in a 301 redirect from the upstream server to /forums/ but _with the upstream hostname. This works fine when I did this with apache (the redirect header used the downstream/proxied hostname).
I’m running caddy via docker (caddy/caddy:alpine) on docker v19.03.5 and docker-compose v1.24.1 on macOS Catalina v10.15.2.
@francislavoie I’ve just noticed this is a problem for all the other routes as well. I’m reverse proxying github pages, so any links to, say, /about, get redirected by github pages’ server to xyz.github.io/about/. Somehow the redirect header is the masked hostname in nginx so it’s not a problem there. Is there, perhaps, a header that nginx passes with proxy_pass that I need to explicitly add with Caddy so that github pages’ server respects my hostname?
Isn’t there a directive in other web servers that can rewrite the hostname in Location response headers?
FWIW, Caddy 2 can do this too. Not sure if it can via Caddyfile (actually I think it can do replacements though, too!) – can anyone spend a minute to find out? I’m preeettttty sure I baked in this capability already.