fix game
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 8m27s
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 8m27s
This commit is contained in:
@@ -32,7 +32,7 @@ func SetupGinServer(ec *nats.EncodedConn, port string) *gin.Engine {
|
||||
// Cache Control Middleware für statische Assets
|
||||
r.Use(func(c *gin.Context) {
|
||||
path := c.Request.URL.Path
|
||||
// Assets (Bilder, Fonts, etc.) - 1 Jahr cachen
|
||||
// Assets (Bilder, Audio, etc.) - 1 Jahr cachen
|
||||
if len(path) > 7 && path[:8] == "/assets/" {
|
||||
c.Header("Cache-Control", "public, max-age=31536000, immutable")
|
||||
}
|
||||
@@ -40,6 +40,14 @@ func SetupGinServer(ec *nats.EncodedConn, port string) *gin.Engine {
|
||||
if (path == "/main.wasm" || path == "/game.js" || path == "/wasm_exec.js") && c.Query("v") != "" {
|
||||
c.Header("Cache-Control", "public, max-age=31536000, immutable")
|
||||
}
|
||||
// CSS und Hintergrundbild - 1 Tag cachen
|
||||
if path == "/style.css" || path == "/background.jpg" {
|
||||
c.Header("Cache-Control", "public, max-age=86400")
|
||||
}
|
||||
// HTML - immer neu laden (enthält BUILD_VERSION für Cache-Busting der JS/WASM)
|
||||
if path == "/" || path == "/index.html" {
|
||||
c.Header("Cache-Control", "no-cache")
|
||||
}
|
||||
c.Next()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user