Pam cache fix

This commit is contained in:
2026-07-14 00:41:55 -03:00
parent 492a7f2002
commit 1797c50ea3
4 changed files with 37 additions and 15 deletions
+9 -2
View File
@@ -20,8 +20,15 @@ func securePanelHandler(next http.Handler) http.Handler {
w.Header().Set("Permissions-Policy", "camera=(), microphone=(), geolocation=(), payment=()")
w.Header().Set("Cross-Origin-Opener-Policy", "same-origin")
w.Header().Set("Content-Security-Policy", "default-src 'self'; base-uri 'none'; frame-ancestors 'none'; object-src 'none'; form-action 'self'; img-src 'self' data:; connect-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'")
if strings.HasPrefix(r.URL.Path, "/api/") || r.URL.Path == "/" || r.URL.Path == "/index.html" {
w.Header().Set("Cache-Control", "no-store")
// The panel is deployed in-place by update.sh. Do not let browsers or
// reverse proxies keep an older JavaScript bundle after an update, because
// stale form serializers can silently omit newly-added config fields.
if strings.HasPrefix(r.URL.Path, "/api/") ||
r.URL.Path == "/" || r.URL.Path == "/index.html" ||
strings.HasPrefix(r.URL.Path, "/assets/") {
w.Header().Set("Cache-Control", "no-store, no-cache, must-revalidate")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Expires", "0")
}
if r.Body != nil && r.Method != http.MethodGet && r.Method != http.MethodHead {
r.Body = http.MaxBytesReader(w, r.Body, maxAdminRequestBody)