Use a custom server header

Signed-off-by: arzumify <jliwin98@danwin1210.de>
This commit is contained in:
Tracker-Friendly 2024-10-24 19:39:45 +01:00
parent 4fc99aeb42
commit dfe1fdf6f0
1 changed files with 7 additions and 0 deletions

View File

@ -65,6 +65,12 @@ var (
slog.Info(r.Method + " " + r.URL.Path) slog.Info(r.Method + " " + r.URL.Path)
}) })
} }
serverChanger = func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
next.ServeHTTP(w, r)
w.Header().Set("Server", "Fulgens HTTP Server")
})
}
validate *validator.Validate validate *validator.Validate
services = make(map[uuid.UUID]Service) services = make(map[uuid.UUID]Service)
lock sync.RWMutex lock sync.RWMutex
@ -481,6 +487,7 @@ func main() {
// Create the router // Create the router
router := chi.NewRouter() router := chi.NewRouter()
router.Use(logger) router.Use(logger)
router.Use(serverChanger)
// Iterate through the service configurations and create routers for each unique subdomain // Iterate through the service configurations and create routers for each unique subdomain
subdomains := make(map[string]*chi.Mux) subdomains := make(map[string]*chi.Mux)