Skip to content

Commit d6385fb

Browse files
committed
Optionally set request.scheme based on X-Forwarded-Proto header in demo_pyramid
1 parent 4380bf1 commit d6385fb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

demo_pyramid/demo_pyramid/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def init_saml_auth(req):
1616

1717
def prepare_pyramid_request(request):
1818
# If server is behind proxys or balancers use the HTTP_X_FORWARDED fields
19+
20+
if 'X-Forwarded-Proto' in request.headers:
21+
request.scheme = request.headers['X-Forwarded-Proto']
22+
1923
return {
2024
'https': 'on' if request.scheme == 'https' else 'off',
2125
'http_host': request.host,

0 commit comments

Comments
 (0)