diff --git a/app/middleware/client.middleware.go b/app/middleware/client.middleware.go index e5b4181..5d26cf9 100644 --- a/app/middleware/client.middleware.go +++ b/app/middleware/client.middleware.go @@ -21,14 +21,19 @@ var excludedPaths = []string{ "/health/*", "/clients", "/clients/*", - "/metrics", - "/metrics/*", + "*/viewer/*", } // isPathExcluded checks if the given path should be excluded from client key validation func isPathExcluded(path string) bool { for _, excludedPath := range excludedPaths { - if strings.HasPrefix(excludedPath, "*") { + if strings.HasPrefix(excludedPath, "*") && strings.HasSuffix(excludedPath, "*") { + // Handle wildcard at both beginning and end (e.g., "*/viewer/*") + pattern := excludedPath[1 : len(excludedPath)-1] // Remove * from both ends + if strings.Contains(path, pattern) { + return true + } + } else if strings.HasPrefix(excludedPath, "*") { // Handle wildcard at the beginning if strings.HasSuffix(path, excludedPath[1:]) { return true