Proxy Trusted Hops
When proxy_mode is enabled, Odoo takes the client address from the X-Forwarded-For header, but it only trusts one proxy: it always takes the last address of the header. Behind more than one reverse proxy (for example a cloud load balancer in front of an ingress controller), that address is one of your own proxies, not the client.
This module lets you configure how many proxies Odoo trusts. Odoo then uses the address added by your outermost proxy, which is the real client.
This affects every place that uses the client address, for example the access log, the login log, the login cooldown after failed attempts, reCAPTCHA, and website visitors.
Table of contents
Installation
You don’t have to install this module in a database. Add it to the server_wide_modules list so it is active as soon as the server starts:
server_wide_modules = base,web,proxy_trusted_hops
Configuration
Set the number of reverse proxies in front of Odoo, either with the ODOO_TRUSTED_PROXIES environment variable or in a [proxy_trusted_hops] section of the Odoo configuration file:
[options]
proxy_mode = True
[proxy_trusted_hops]
trusted_proxies = 2
The environment variable takes precedence over the configuration file. When the server_environment module is on the addons path, the section is read through it, so it can also come from its environment files; the Odoo configuration file is still included there.
As in Odoo itself, the header is only used when proxy_mode is enabled and the request contains an X-Forwarded-Host header.
With trusted_proxies = N, Odoo uses the N-th address from the end of the X-Forwarded-For header. If the header contains fewer addresses than that, Odoo keeps the address of the connecting proxy.
Security warning: the client can send its own X-Forwarded-For header, and proxies only add their entry to it. Never set a value higher than the number of proxies that actually add an entry: otherwise the client decides which address Odoo sees, and can for example get around the login cooldown. Each proxy must add its entry to the header.
Check the server log at startup:
INFO ? odoo.addons.proxy_trusted_hops.patch: Trusting 2 proxies for the X-Forwarded-For header.
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
-
Bastian Günther <bastian.guenther@ametras.com>
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/server-tools project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Metadata
Release files for odoo-addon-proxy-trusted-hops 16.0.1.0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| odoo_addon_proxy_trusted_hops-16.0.1.0.0.3-py3-none-any.whl | Python 3 | none | any | Details for odoo_addon_proxy_trusted_hops-16.0.1.0.0.3-py3-none-any.whl |
Release files / odoo_addon_proxy_trusted_hops-16.0.1.0.0.3-py3-none-any.whl
| Download URL | odoo_addon_proxy_trusted_hops-16.0.1.0.0.3-py3-none-any.whl |
|---|---|
| Size | 28.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38be4001b90f80654a9faf4482f49ad2a9f84cafd23e5de181b9ed8e016e0bd1
|
|
BLAKE2b-256 checksum How to use checksums |
4c4552d49af37d2b5424ae27a3e33d9b11bd8cc89e67975ad87639f5b36da7f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for odoo-addon-proxy-trusted-hops 16.0.1.0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.