From 2964cd54fac20ccb00186a6335855a3b5bf334b1 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Tue, 15 Oct 2024 13:42:09 -0400 Subject: [PATCH] Skip validate when auth token is empty --- comp/otelcol/ddflareextension/impl/server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/comp/otelcol/ddflareextension/impl/server.go b/comp/otelcol/ddflareextension/impl/server.go index 4b3c0fcf0c104..f4eadd14db495 100644 --- a/comp/otelcol/ddflareextension/impl/server.go +++ b/comp/otelcol/ddflareextension/impl/server.go @@ -32,8 +32,10 @@ type server struct { // validateToken - validates token for legacy API func validateToken(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if err := util.Validate(w, r); err != nil { - return + if util.GetAuthToken() != "" { + if err := util.Validate(w, r); err != nil { + return + } } next.ServeHTTP(w, r) })