Add a wsgi wrapper to tahrir to handle our reverse proxy setup.
This commit is contained in:
parent
7dc7a9207e
commit
fed9e14bb8
1 changed files with 10 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
import sys
|
||||
import sys
|
||||
sys.stdout = sys.stderr
|
||||
|
||||
import __main__
|
||||
|
@ -12,4 +12,12 @@ os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs'
|
|||
from pyramid.paster import get_app, setup_logging
|
||||
ini_path = '/etc/tahrir/tahrir.ini'
|
||||
setup_logging(ini_path)
|
||||
application = get_app(ini_path, 'main')
|
||||
|
||||
pyramid_app = get_app(ini_path, 'main')
|
||||
|
||||
def reverse_proxy_handler(environ, start_response):
|
||||
environ['HTTP_HOST'] = environ['HTTP_X_FORWARDED_HOST']
|
||||
environ['wsgi.url_scheme'] = 'https'
|
||||
return pyramid_app(environ, start_response)
|
||||
|
||||
application = reverse_proxy_handler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue