Hotfix: Upgrade heroku apps to https for all endpoints

The previous implementation of the is_heroku check in
search.needs_https() was implemented to only match URLs ending in
'.herokuapp.com', and skipped upgrading to HTTPS for other endpoints.
This commit is contained in:
Ben Busby 2021-03-31 12:14:38 -04:00 committed by Ben Busby
parent 3312072cc1
commit ed4432f3f8

View File

@ -25,7 +25,7 @@ def needs_https(url: str) -> bool:
""" """
https_only = bool(os.getenv('HTTPS_ONLY', 0)) https_only = bool(os.getenv('HTTPS_ONLY', 0))
is_heroku = url.endswith('.herokuapp.com') is_heroku = '.herokuapp.com' in url
is_http = url.startswith('http://') is_http = url.startswith('http://')
return (is_heroku and is_http) or (https_only and is_http) return (is_heroku and is_http) or (https_only and is_http)