[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

@ -25,12 +25,6 @@ import (
"github.com/gin-gonic/gin"
)
// ActivityPubAcceptHeaders represents the Accept headers mentioned here:
var ActivityPubAcceptHeaders = []MIME{
AppActivityJSON,
AppActivityLDJSON,
}
// JSONAcceptHeaders is a slice of offers that just contains application/json types.
var JSONAcceptHeaders = []MIME{
AppJSON,
@ -59,12 +53,34 @@ var HTMLAcceptHeaders = []MIME{
}
// HTMLOrActivityPubHeaders matches text/html first, then activitypub types.
// This is useful for user URLs that a user might go to in their browser.
// This is useful for user URLs that a user might go to in their browser,
// but which should also be able to serve ActivityPub as a fallback.
//
// https://www.w3.org/TR/activitypub/#retrieving-objects
var HTMLOrActivityPubHeaders = []MIME{
TextHTML,
AppActivityJSON,
AppActivityLDJSON,
AppActivityJSON,
}
// ActivityPubOrHTMLHeaders matches activitypub types first, then text/html.
// This is useful for URLs that should serve ActivityPub by default, but
// which a user might also go to in their browser sometimes.
//
// https://www.w3.org/TR/activitypub/#retrieving-objects
var ActivityPubOrHTMLHeaders = []MIME{
AppActivityLDJSON,
AppActivityJSON,
TextHTML,
}
// ActivityPubHeaders matches only activitypub Accept headers.
// This is useful for URLs should only serve ActivityPub.
//
// https://www.w3.org/TR/activitypub/#retrieving-objects
var ActivityPubHeaders = []MIME{
AppActivityLDJSON,
AppActivityJSON,
}
var HostMetaHeaders = []MIME{