diff --git a/internal/pages/pages.go b/internal/pages/pages.go index c4acaf0..7573fdc 100644 --- a/internal/pages/pages.go +++ b/internal/pages/pages.go @@ -140,7 +140,7 @@ func FaqHandler(pages *Pages, cfg config.Config) http.HandlerFunc { func (pages *Pages) HTTPError(w http.ResponseWriter, r *http.Request, message string, status int, title ...string) { if strings.Contains(r.Header.Get("Accept"), "text/html") { - t := fmt.Sprintf("%c", status) + t := fmt.Sprintf("errror %d", status) if len(title) > 0 { t = title[0] } diff --git a/internal/server/routes.go b/internal/server/routes.go index 9adbfea..fd696a2 100644 --- a/internal/server/routes.go +++ b/internal/server/routes.go @@ -56,14 +56,19 @@ func NewRouter(db *gorm.DB, cfg config.Config, p *pages.Pages, tracker *uploads. mux.HandleFunc("GET /health", health) if len(cfg.BannedClientASNs) > 0 && len(asnMMDB) > 0 { - ammdb := asnMMDB[0] blocker := &middleware.ASNBlocker{ - DB: ammdb, + DB: asnMMDB[0], Blocked: cfg.BannedClientASNs, ResolveIP: cipr, Pages: p, } - return blocker.BlockASN(mux) + + outer := http.NewServeMux() + for _, path := range []string{"/qts/", "/static/", "/js/", "/css/"} { + outer.Handle("GET "+path, mux) + } + outer.Handle("/", blocker.BlockASN(mux)) + return outer } return mux }