Add "X-Forwarded-Host {host}" to the "transparent" preset.
WSGI applications using werkzeug Version 0.11 or higher (for example Odoo) need to have the X-Forwarded-Host {host} to work properly (get proper REMOTE_ADDR).
At the moment I use the preset and add the upstream header manually.
My Caddyfile:
example.com {
redir https://www.example.com
}
www.example.com {
proxy / http://xxx.xxx.xxx.xxx:8069 {
transparent
header_upstream X-Forwarded-Host {host} # transparent preset is not enough
# header_upstream X-Odoo-dbfilter databasename # in case you use dbfilter_from_header
}
}
Have you tried upgrading werkzeug to 0.15(Unreleased)? Looks like the latest version doesn't rely on X-Forwarded-Host
anymore.
Well spotted, thanks. But it might take some time until werkzeug 0.15 will be widely adopted.
I'm not convinced this needs to be implemented unless we have more evidence of other apps needing it as well. It seems pretty standard to just use the Host
header.
I'll close this, but if a couple more examples are shown, or if they have a good reason not to use Host
, then I'm sure we can reconsider and reopen this.
Most helpful comment
Have you tried upgrading werkzeug to 0.15(Unreleased)? Looks like the latest version doesn't rely on
X-Forwarded-Host
anymore.