mirror of
				https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
				synced 2025-10-31 02:05:32 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			427 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			427 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package server
 | |
| 
 | |
| import (
 | |
| 	"log/slog"
 | |
| 	"strings"
 | |
| 
 | |
| 	"github.com/gofiber/fiber/v2"
 | |
| )
 | |
| 
 | |
| func CacheFunc(c *fiber.Ctx) bool {
 | |
| 	path := c.Path()
 | |
| 	// INFO: for now, css and js files are excluded from caching; they get cached via ETag to enable reloading on style changes.
 | |
| 	slog.Debug("CacheFunc:", "path", path)
 | |
| 	return c.Query("noCache") == "true" || c.Response().StatusCode() != fiber.StatusOK || strings.HasPrefix(path, "/assets")
 | |
| }
 | 
