From 805439e6ee287de6379bea42f02a60ce0344ba4f Mon Sep 17 00:00:00 2001 From: thomasDOTde Date: Tue, 31 Oct 2017 20:42:13 +0100 Subject: [PATCH] updated preapre_flask_request to support frontend-ssl --- app/lib/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/lib/utils.py b/app/lib/utils.py index 1156da3..f824ea0 100644 --- a/app/lib/utils.py +++ b/app/lib/utils.py @@ -164,13 +164,18 @@ def email_to_gravatar_url(email, size=100): return "https://s.gravatar.com/avatar/%s?s=%s" % (hash_string, size) def prepare_flask_request(request): + # If server is behind proxys or balancers use the HTTP_X_FORWARDED fields url_data = urlparse.urlparse(request.url) return { + 'https': 'on' if request.scheme == 'https' else 'off', 'http_host': request.host, 'server_port': url_data.port, 'script_name': request.path, 'get_data': request.args.copy(), - 'post_data': request.form.copy() + 'post_data': request.form.copy(), + # Uncomment if using ADFS as IdP, https://github.com/onelogin/python-saml/pull/144 + # 'lowercase_urlencoding': True, + 'query_string': request.query_string } def init_saml_auth(req):