Manage 'X-Forwarded' headers from proxies

issue7110
review41031002
This commit is contained in:
Cédric Krier
2018-02-14 19:23:11 +01:00
parent 7388e7b233
commit e8ee8dedac
4 changed files with 13 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
* Manage 'X-Forwarded' headers from proxies
* Add '_request' attribute to Transaction context
* Delete translations on deletion only when model has translatable field
* Remove MySQL backend
+7
View File
@@ -54,6 +54,13 @@ Defines the root path served by `GET` requests.
Default: Under the `www` directory of user's home running `trytond`.
num_proxies
~~~~~~~~~~~
The number of proxy servers in front of `trytond`.
Default: 0
database
--------
+1
View File
@@ -44,6 +44,7 @@ class TrytonConfigParser(ConfigParser.RawConfigParser):
self.add_section('web')
self.set('web', 'listen', 'localhost:8000')
self.set('web', 'root', os.path.join(os.path.expanduser('~'), 'www'))
self.set('web', 'num_proxies', 0)
self.add_section('database')
self.set('database', 'uri',
os.environ.get('TRYTOND_DATABASE_URI', 'sqlite://'))
+4
View File
@@ -8,6 +8,7 @@ import traceback
from werkzeug.wrappers import Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import abort, HTTPException, InternalServerError
from werkzeug.contrib.fixers import ProxyFix
import wrapt
@@ -118,4 +119,7 @@ class TrytondWSGI(object):
return self.wsgi_app(environ, start_response)
app = TrytondWSGI()
num_proxies = config.getint('web', 'num_proxies')
if num_proxies:
app.wsgi_app = ProxyFix(app.wsgi_app, num_proxies=num_proxies)
import trytond.protocols.dispatcher