httpd: allow to configure cache control header

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2024-08-12 21:52:59 +02:00
parent 2cc2fc64db
commit 6f8bc59756
8 changed files with 40 additions and 3 deletions

View File

@@ -2942,6 +2942,7 @@ func TestSecureMiddlewareIntegration(t *testing.T) {
STSIncludeSubdomains: true,
STSPreload: true,
ContentTypeNosniff: true,
CacheControl: "private",
},
},
enableWebAdmin: true,
@@ -2961,6 +2962,7 @@ func TestSecureMiddlewareIntegration(t *testing.T) {
r.Host = "127.0.0.1"
server.router.ServeHTTP(rr, r)
assert.Equal(t, http.StatusForbidden, rr.Code)
assert.Equal(t, "no-cache, no-store, max-age=0, must-revalidate, private", rr.Header().Get("Cache-Control"))
rr = httptest.NewRecorder()
r.Header.Set(forwardedHostHeader, "www.sftpgo.com")