File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1022,6 +1022,12 @@ def redirect_to_canonical_host():
10221022 request_url = urllib .parse .urlparse (request .url )
10231023 redirect_url = request_url
10241024
1025+ # Assume that we're always deployed behind something that hides https:// from us.
1026+ # In production TLS is terminated at ELB, so the actual bors app sees only http:// requests.
1027+ request_url = redirect_url ._replace (
1028+ scheme = "https"
1029+ )
1030+
10251031 # Disable redirects on the health check endpoint.
10261032 if request_url .path == "/health" :
10271033 return
@@ -1042,9 +1048,8 @@ def redirect_to_canonical_host():
10421048 elif redirect_url .path == "/" + prefix :
10431049 redirect_url = redirect_url ._replace (path = "/" )
10441050
1045- print ("request_url=" , request_url )
1046- print ("redirect_url=" , redirect_url )
10471051 if request_url != redirect_url :
1052+ print ("redirecting original=" + request_url + " to new=" + redirect_url )
10481053 redirect (urllib .parse .urlunparse (redirect_url ), 301 )
10491054
10501055
You can’t perform that action at this time.
0 commit comments