mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-31 18:17:23 +01:00
removes br check inside static logic
This commit is contained in:
@@ -3,10 +3,7 @@ package web
|
||||
import (
|
||||
"html/template"
|
||||
"io"
|
||||
"mime"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
@@ -24,14 +21,7 @@ func (h *handler) index(w http.ResponseWriter, req *http.Request) {
|
||||
_, err := h.content.Open(path)
|
||||
if err == nil && req.URL.Path != "" && req.URL.Path != "/" {
|
||||
w.Header().Set("Cache-Control", "max-age=31536000, immutable")
|
||||
// if brotli is enabled, then just send over the compressed file
|
||||
if file, err := h.content.Open(path + ".br"); strings.Contains(req.Header.Get("Accept-Encoding"), "br") && err == nil {
|
||||
w.Header().Set("Content-Encoding", "br")
|
||||
w.Header().Set("Content-Type", mime.TypeByExtension(filepath.Ext(path)))
|
||||
io.Copy(w, file)
|
||||
} else {
|
||||
fileServer.ServeHTTP(w, req)
|
||||
}
|
||||
fileServer.ServeHTTP(w, req)
|
||||
} else {
|
||||
h.executeTemplate(w, req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user