Manage 'X-Forwarded' headers from proxies
issue7110 review41031002
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
--------
|
||||
|
||||
|
||||
@@ -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://'))
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user