Fix 404 handling
All checks were successful
/ build-container (push) Successful in 1m19s

This commit is contained in:
Finn 2024-03-31 23:20:10 -07:00
parent 8db19d293d
commit 76697e2682

View file

@ -52,14 +52,14 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
slog.Info("GET", "domain", domain, "path", path)
stat, err := object.Stat()
if err != nil {
resp := minio.ToErrorResponse(err)
if resp.StatusCode == http.StatusNotFound {
// TODO: custom 404 page
w.WriteHeader(http.StatusNotFound)
w.Write([]byte("404 not found"))
slog.Info("served 404", "domain", domain, "path", path)
return
}