diff options
author | 2023-02-12 14:42:28 +0100 | |
---|---|---|
committer | 2023-02-12 14:42:28 +0100 | |
commit | c223c7598dcd44db9befcce8fb49c6dbbcfac36d (patch) | |
tree | b876545c0adf1e0e63584a9f52df11376ea918e8 /internal/api/fileserver | |
parent | [chore/performance] Update media prune logic, add extra CLI command (#1474) (diff) | |
download | gotosocial-c223c7598dcd44db9befcce8fb49c6dbbcfac36d.tar.xz |
[bugfix] Set appropriate cache-control when using presigned s3 links (#1480)
Diffstat (limited to 'internal/api/fileserver')
-rw-r--r-- | internal/api/fileserver/servefile.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/api/fileserver/servefile.go b/internal/api/fileserver/servefile.go index cdd42a179..6b125debc 100644 --- a/internal/api/fileserver/servefile.go +++ b/internal/api/fileserver/servefile.go @@ -88,7 +88,12 @@ func (m *Module) ServeFile(c *gin.Context) { } if content.URL != nil { - // This is a non-local S3 file we're proxying to. + // This is a non-local S3 file we're redirecting to. + // Rewrite the cache control header to reflect the + // TTL of the generated signed link, instead of the + // default very long cache. + const cacheControl = "private,max-age=86400" // 24h + c.Header("Cache-Control", cacheControl) c.Redirect(http.StatusFound, content.URL.String()) return } |