Merge pull request #6432 from diwakar-s-maurya/main

fix: Prevent crash while setting Strict-Transport-Security security header
This commit is contained in:
Timothy Jaeryang Baek 2024-10-26 00:23:15 -07:00 committed by GitHub
commit 554e181ccb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,7 +60,7 @@ def set_hsts(value: str):
pattern = r"^max-age=(\d+)(;includeSubDomains)?(;preload)?$"
match = re.match(pattern, value, re.IGNORECASE)
if not match:
return "max-age=31536000;includeSubDomains"
value = "max-age=31536000;includeSubDomains"
return {"Strict-Transport-Security": value}