Caddy: Proxy preset `transparent` should use X-Forwarded-Host {host}

Created on 10 Mar 2019  路  3Comments  路  Source: caddyserver/caddy

1. What would you like to have changed?


Add "X-Forwarded-Host {host}" to the "transparent" preset.

2. Why is this feature a useful, necessary, and/or important addition to this project?


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).

3. What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?


At the moment I use the preset and add the upstream header manually.

4. Please link to any relevant issues, pull requests, or other discussions.


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

    }
}
feature request

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PhilmacFLy picture PhilmacFLy  路  3Comments

crvv picture crvv  路  3Comments

lorddaedra picture lorddaedra  路  3Comments

mschneider82 picture mschneider82  路  3Comments

kilpatty picture kilpatty  路  3Comments