refactoring of code

This commit is contained in:
Jonas Kaninda
2024-10-30 20:48:58 +01:00
parent c228c605ef
commit 3ad36e5041
3 changed files with 13 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ func (blockList AccessListMiddleware) AccessMiddleware(next http.Handler) http.H
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
for _, block := range blockList.List {
if isPathBlocked(r.URL.Path, util.ParseURLPath(blockList.Path+block)) {
logger.Debug("%s: access to %s is forbidden", getRealIP(r), r.URL.Path)
logger.Debug("%s: %s access forbidden", getRealIP(r), r.URL.Path)
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusNotFound)
err := json.NewEncoder(w).Encode(ProxyResponseError{