move x-accel into local storage configuration
All checks were successful
build container / build-container (push) Successful in 5m45s
run go test / test (push) Successful in 3m15s

This commit is contained in:
2025-03-03 09:15:37 +08:00
parent 504a809c16
commit 83dfcba4ae
4 changed files with 33 additions and 29 deletions

View File

@ -107,7 +107,7 @@ type Chunk struct {
}
func (server *Server) serveFile(w http.ResponseWriter, r *http.Request, path string) {
if location := r.Header.Get(server.Storage.Accel.EnableByHeader); server.Storage.Accel.EnableByHeader != "" && location != "" {
if location := r.Header.Get(server.Storage.Local.Accel.EnableByHeader); server.Storage.Local.Accel.EnableByHeader != "" && location != "" {
relPath, err := filepath.Rel(server.Storage.Local.Path, path)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
@ -115,7 +115,7 @@ func (server *Server) serveFile(w http.ResponseWriter, r *http.Request, path str
}
accelPath := filepath.Join(location, relPath)
for _, headerKey := range server.Storage.Accel.ResponseWithHeaders {
for _, headerKey := range server.Storage.Local.Accel.RespondWithHeaders {
w.Header().Set(headerKey, accelPath)
}