Wrong IP-address in werkzeug's log messages when in proxy mode
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
If OpenERP 7.0 runs behind a proxy in the log messages the IP-address of the proxy server is reported.
One could say this is correct since each request to OpenERP comes from the proxy. But, in this case the log is not very helpful.
I made a branch where at the beginning of wsgi_server.py (right after the imports) a new address_
_handler_clazz = werkzeug.
_handler_
Now, I can see where the request to the proxy came from.
Probably it would look more clearly if we subclass WSGIRequestHandler and tell Werkzeug to use this subclass, but it works and needs only 2 (6) lines of code.
Hello! Big thank for you solution and I found how make it with only one line in wsgi_server.py:
def application( environ, start_response): 'proxy_ mode'] and 'HTTP_X_ FORWARDED_ HOST' in environ: serving. WSGIRequestHand ler.address_ string = lambda self: self.headers. get('x- real-ip' , self.client_ address[ 0]) contrib. fixers. ProxyFix( application_ unproxied) (environ, start_response) unproxied( environ, start_response)
if config[
+ werkzeug.
return werkzeug.
else:
return application_