[bugfix] Set Vary header correctly on cache-control (#1988)

* [bugfix] Set Vary header correctly on cache-control

* Prefer activitypub types on AP endpoints

* use immutable on file server, vary by range

* vary auth on Accept
This commit is contained in:
tobi
2023-07-13 21:27:25 +02:00
committed by GitHub
parent 88688899aa
commit 12b6cdcd8c
19 changed files with 132 additions and 41 deletions

View File

@ -36,8 +36,11 @@ func (w *NodeInfo) Route(r router.Router, m ...gin.HandlerFunc) {
// attach middlewares appropriate for this group
nodeInfoGroup.Use(m...)
nodeInfoGroup.Use(
// allow cache for 2 minutes
middleware.CacheControl("public", "max-age=120"),
// Allow public cache for 2 minutes.
middleware.CacheControl(middleware.CacheControlConfig{
Directives: []string{"public", "max-age=120"},
Vary: []string{"Accept-Encoding"},
}),
)
w.nodeInfo.Route(nodeInfoGroup.Handle)