From 63ce8f22956c3c4f939eeccd55c9299b250bffa0 Mon Sep 17 00:00:00 2001 From: Paulo Luna Date: Wed, 5 Aug 2026 12:05:25 -0300 Subject: [PATCH] fix(metrics): collect metrics for non-OPTIONS requests Fix the inverted HTTP metrics skip condition, which caused the collector to ignore all requests except OPTIONS. Apply the correction to both the main and Noise routers so regular HTTP traffic is included in http_requests_total and http_request_duration_seconds. --- hscontrol/app.go | 2 +- hscontrol/noise.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hscontrol/app.go b/hscontrol/app.go index 26311f39e..22c0a2668 100644 --- a/hscontrol/app.go +++ b/hscontrol/app.go @@ -446,7 +446,7 @@ func (h *Headscale) createRouter(apiV1Mux, apiV2Mux http.Handler) *chi.Mux { Host: false, Proto: true, Skip: func(r *http.Request) bool { - return r.Method != http.MethodOptions + return r.Method == http.MethodOptions }, })) r.Use(middleware.RequestID) diff --git a/hscontrol/noise.go b/hscontrol/noise.go index 3c6bb6e2a..615d63bd3 100644 --- a/hscontrol/noise.go +++ b/hscontrol/noise.go @@ -150,7 +150,7 @@ func (h *Headscale) NoiseUpgradeHandler( Host: false, Proto: true, Skip: func(r *http.Request) bool { - return r.Method != http.MethodOptions + return r.Method == http.MethodOptions }, })) r.Use(middleware.RequestID)