From 33db8c6b2940b716fb2e7bc5c848f98e8ba06b51 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. (cherry picked from commit 63ce8f22956c3c4f939eeccd55c9299b250bffa0) --- 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 fc0869b0..d2c9eee8 100644 --- a/hscontrol/app.go +++ b/hscontrol/app.go @@ -531,7 +531,7 @@ func (h *Headscale) createRouter(grpcMux *grpcRuntime.ServeMux) *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 8f65a1ea..a88323ac 100644 --- a/hscontrol/noise.go +++ b/hscontrol/noise.go @@ -153,7 +153,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)