瀏覽代碼

Prevent crash while setting Strict-Transport-Security security header

Diwakar 6 月之前
父節點
當前提交
0a7bc50279
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      backend/open_webui/utils/security_headers.py

+ 1 - 1
backend/open_webui/utils/security_headers.py

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