Properly use x-forwarded-proto with redirects in the webui, related to #347
This commit is contained in:
@@ -12,6 +12,8 @@ import docker
|
||||
import socket
|
||||
import uuid
|
||||
|
||||
from werkzeug.contrib import fixers
|
||||
|
||||
# Create application
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
@@ -113,9 +115,10 @@ class PrefixMiddleware(object):
|
||||
self.app = app
|
||||
|
||||
def __call__(self, environ, start_response):
|
||||
print(environ)
|
||||
prefix = environ.get('HTTP_X_FORWARDED_PREFIX', '')
|
||||
if prefix:
|
||||
environ['SCRIPT_NAME'] = prefix
|
||||
return self.app(environ, start_response)
|
||||
|
||||
app.wsgi_app = PrefixMiddleware(app.wsgi_app)
|
||||
app.wsgi_app = PrefixMiddleware(fixers.ProxyFix(app.wsgi_app))
|
||||
|
||||
Reference in New Issue
Block a user