Skip to content

Commit

Permalink
Solve HTTPs issue on demos
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Apr 14, 2015
1 parent d0aa836 commit 15a331e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions demo-django/demo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def init_saml_auth(req):


def prepare_django_request(request):
# If server is behind proxys or balancers use the HTTP_X_FORWARDED fields
result = {
'https': 'on' if request.is_secure() else 'off',
'http_host': request.META['HTTP_HOST'],
'script_name': request.META['PATH_INFO'],
'server_port': request.META['SERVER_PORT'],
Expand Down
2 changes: 2 additions & 0 deletions demo-flask/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ def init_saml_auth(req):


def prepare_flask_request(request):
# If server is behind proxys or balancers use the HTTP_X_FORWARDED fields
url_data = 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,
Expand Down

0 comments on commit 15a331e

Please sign in to comment.