Correct http cache headers for firefox (#3017)

Co-authored-by: Luca Marinucci <luca.marinucci@devlux.ch>
Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
devlux 2023-12-26 07:37:13 +00:00 committed by GitHub
parent 28bd6cc690
commit 5671956a31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -44,7 +44,7 @@ import (
// @Tags Events // @Tags Events
func EventStreamSSE(c *gin.Context) { func EventStreamSSE(c *gin.Context) {
c.Header("Content-Type", "text/event-stream") c.Header("Content-Type", "text/event-stream")
c.Header("Cache-Control", "no-cache") c.Header("Cache-Control", "no-store")
c.Header("Connection", "keep-alive") c.Header("Connection", "keep-alive")
c.Header("X-Accel-Buffering", "no") c.Header("X-Accel-Buffering", "no")

View file

@ -109,7 +109,7 @@ func serveFile(f *prefixFS) func(ctx *gin.Context) {
case strings.HasSuffix(ctx.Request.URL.Path, ".png"): case strings.HasSuffix(ctx.Request.URL.Path, ".png"):
mime = "image/png" mime = "image/png"
case strings.HasSuffix(ctx.Request.URL.Path, ".svg"): case strings.HasSuffix(ctx.Request.URL.Path, ".svg"):
mime = "image/svg" mime = "image/svg+xml"
} }
ctx.Status(http.StatusOK) ctx.Status(http.StatusOK)
ctx.Writer.Header().Set("Cache-Control", "public, max-age=31536000") ctx.Writer.Header().Set("Cache-Control", "public, max-age=31536000")