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:18:16 +02:00
parent 321c3f00d2
commit fa710b36c2
10 changed files with 53 additions and 16 deletions

View File

@@ -418,6 +418,7 @@ func TestMain(m *testing.M) {
Value: "https",
},
},
CacheControl: "private",
}
httpdtest.SetBaseURL(httpBaseURL)
// required to test sftpfs
@@ -13149,12 +13150,14 @@ func TestDefender(t *testing.T) {
req.RemoteAddr = remoteAddr
rr = executeRequest(req)
checkResponseCode(t, http.StatusOK, rr)
assert.Empty(t, rr.Header().Get("Cache-Control"))
req, err = http.NewRequest(http.MethodGet, "/.well-known/acme-challenge/foo", nil)
assert.NoError(t, err)
req.RemoteAddr = remoteAddr
rr = executeRequest(req)
checkResponseCode(t, http.StatusNotFound, rr)
assert.Equal(t, "no-cache, no-store, max-age=0, must-revalidate, private", rr.Header().Get("Cache-Control"))
_, err = httpdtest.RemoveUser(user, http.StatusOK)
assert.NoError(t, err)