diff --git a/controller/handler/badge.go b/controller/handler/badge.go index 99e1cc24..a7e3af1d 100644 --- a/controller/handler/badge.go +++ b/controller/handler/badge.go @@ -51,11 +51,10 @@ func UptimeBadge(writer http.ResponseWriter, request *http.Request) { } return } - formattedDate := time.Now().Format(http.TimeFormat) - writer.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") - writer.Header().Set("Date", formattedDate) - writer.Header().Set("Expires", formattedDate) writer.Header().Set("Content-Type", "image/svg+xml") + writer.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + writer.Header().Set("Expires", "0") + writer.WriteHeader(http.StatusOK) _, _ = writer.Write(generateUptimeBadgeSVG(duration, uptime)) } @@ -89,11 +88,10 @@ func ResponseTimeBadge(writer http.ResponseWriter, request *http.Request) { } return } - formattedDate := time.Now().Format(http.TimeFormat) - writer.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") - writer.Header().Set("Date", formattedDate) - writer.Header().Set("Expires", formattedDate) writer.Header().Set("Content-Type", "image/svg+xml") + writer.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + writer.Header().Set("Expires", "0") + writer.WriteHeader(http.StatusOK) _, _ = writer.Write(generateResponseTimeBadgeSVG(duration, averageResponseTime)) } diff --git a/controller/handler/chart.go b/controller/handler/chart.go index b8213b9c..d2df7809 100644 --- a/controller/handler/chart.go +++ b/controller/handler/chart.go @@ -112,6 +112,9 @@ func ResponseTimeChart(writer http.ResponseWriter, r *http.Request) { Series: []chart.Series{series}, } writer.Header().Set("Content-Type", "image/svg+xml") + writer.Header().Set("Cache-Control", "no-cache, no-store") + writer.Header().Set("Expires", "0") + writer.WriteHeader(http.StatusOK) if err := graph.Render(chart.SVG, writer); err != nil { log.Println("[handler][ResponseTimeChart] Failed to render response time chart:", err.Error()) return