Remove static cache

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-04-30 08:53:29 -07:00
parent 4e6cc81a38
commit 329d52f9c4

View File

@@ -17,8 +17,6 @@ package web
import (
"io/fs"
"net/http"
"strings"
"time"
"github.com/getprobo/probo/apps/console"
)
@@ -63,12 +61,6 @@ func (s *Server) ServeSPA(w http.ResponseWriter, r *http.Request) {
f, err := s.spaFS.Open(path)
if err == nil {
defer f.Close()
if isStaticFile(path) {
w.Header().Set("Cache-Control", "public, max-age=31536000")
w.Header().Set("Expires", time.Now().Add(365*24*time.Hour).Format(time.RFC1123))
}
http.FileServer(s.spaFS).ServeHTTP(w, r)
return
}
@@ -81,16 +73,6 @@ func (s *Server) ServeSPA(w http.ResponseWriter, r *http.Request) {
w.Write(s.indexContent)
}
func isStaticFile(path string) bool {
extensions := []string{".js", ".css", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".ico", ".woff", ".woff2", ".ttf", ".eot"}
for _, ext := range extensions {
if strings.HasSuffix(path, ext) {
return true
}
}
return false
}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.ServeSPA(w, r)
}