Skip to content

Commit 707fd2a

Browse files
committed
Optionally set request.server_port based on X-Forwarded-Port header in demo_pyramid
1 parent d6385fb commit 707fd2a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

demo_pyramid/demo_pyramid/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def prepare_pyramid_request(request):
1919

2020
if 'X-Forwarded-Proto' in request.headers:
2121
request.scheme = request.headers['X-Forwarded-Proto']
22+
if 'X-Forwarded-Port' in request.headers:
23+
request.server_port = int(request.headers['X-Forwarded-Port'])
2224

2325
return {
2426
'https': 'on' if request.scheme == 'https' else 'off',

0 commit comments

Comments
 (0)