http: add cache-control headers to prevent caching by other proxies elsewhere

This commit is contained in:
WeebDataHoarder
2025-05-13 23:48:21 +02:00
parent 163fce6cfc
commit 6032ac0b78
7 changed files with 14 additions and 1 deletions

View File

@@ -28,7 +28,9 @@ func (a Block) Handle(logger *slog.Logger, w http.ResponseWriter, r *http.Reques
data := challenge.RequestDataFromContext(r.Context())
w.Header().Set("Content-Type", "text/plain")
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Connection", "close")
data.ResponseHeaders(w)
w.WriteHeader(a.Code)
_, _ = w.Write([]byte(fmt.Errorf("access blocked: blocked by administrative rule %s/%s", data.Id.String(), a.RuleHash).Error()))