mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-14 03:17:27 -06:00
[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:
parent
88688899aa
commit
12b6cdcd8c
19 changed files with 132 additions and 41 deletions
|
|
@ -43,13 +43,16 @@ func (a *Auth) Route(r router.Router, m ...gin.HandlerFunc) {
|
|||
|
||||
// instantiate + attach shared, non-global middlewares to both of these groups
|
||||
var (
|
||||
cacheControlMiddleware = middleware.CacheControl("private", "max-age=120")
|
||||
sessionMiddleware = middleware.Session(a.sessionName, a.routerSession.Auth, a.routerSession.Crypt)
|
||||
ccMiddleware = middleware.CacheControl(middleware.CacheControlConfig{
|
||||
Directives: []string{"private", "max-age=120"},
|
||||
Vary: []string{"Accept", "Accept-Encoding"},
|
||||
})
|
||||
sessionMiddleware = middleware.Session(a.sessionName, a.routerSession.Auth, a.routerSession.Crypt)
|
||||
)
|
||||
authGroup.Use(m...)
|
||||
oauthGroup.Use(m...)
|
||||
authGroup.Use(cacheControlMiddleware, sessionMiddleware)
|
||||
oauthGroup.Use(cacheControlMiddleware, sessionMiddleware)
|
||||
authGroup.Use(ccMiddleware, sessionMiddleware)
|
||||
oauthGroup.Use(ccMiddleware, sessionMiddleware)
|
||||
|
||||
a.auth.RouteAuth(authGroup.Handle)
|
||||
a.auth.RouteOauth(oauthGroup.Handle)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue