add ProxyFix WSGI middleware for real IP and remove dead code

This commit is contained in:
Martin Zimmermann 2013-09-13 16:13:03 +02:00
parent e56d6a087a
commit 7ed5d6461e

View File

@ -123,14 +123,6 @@ class Isso(object):
return response(environ, start_response) return response(environ, start_response)
def __call__(self, environ, start_response): def __call__(self, environ, start_response):
script_name = environ.get('HTTP_X_SCRIPT_NAME')
if script_name:
environ['SCRIPT_NAME'] = script_name
path_info = environ['PATH_INFO']
if path_info.startswith(script_name):
environ['PATH_INFO'] = path_info[len(script_name):]
return self.wsgi_app(environ, start_response) return self.wsgi_app(environ, start_response)
@ -199,10 +191,10 @@ def main():
mailer=mailer mailer=mailer
) )
app = wsgi.SubURI(SharedDataMiddleware(isso.wsgi_app, { app = ProxyFix(wsgi.SubURI(SharedDataMiddleware(isso.wsgi_app, {
'/static': join(dirname(__file__), 'static/'), '/static': join(dirname(__file__), 'static/'),
'/js': join(dirname(__file__), 'js/') '/js': join(dirname(__file__), 'js/')
})) })))
run_simple(conf.get('server', 'host'), conf.getint('server', 'port'), run_simple(conf.get('server', 'host'), conf.getint('server', 'port'),
app, threaded=True, use_reloader=conf.getboolean('server', 'reload')) app, threaded=True, use_reloader=conf.getboolean('server', 'reload'))