Add a wsgi wrapper to tahrir to handle our reverse proxy setup.

This commit is contained in:
Ralph Bean 2013-07-02 02:05:13 +00:00
parent 7dc7a9207e
commit fed9e14bb8

View file

@ -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