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
parent fb863b5b52
commit 86ae2bda3e
No known key found for this signature in database
GPG Key ID: 3B08611DF6E62ED2

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)