|
@@ -51,7 +51,7 @@ func forbidden(w http.ResponseWriter) {
|
|
|
http.Error(w, "Forbidden", http.StatusForbidden)
|
|
|
}
|
|
|
|
|
|
-func isNoAuthPath(path string) bool {
|
|
|
+func isNoAuthPath(path string, metricsWithoutAuth bool) bool {
|
|
|
// Local variable instead of module var to prevent accidental mutation
|
|
|
noAuthPaths := []string{
|
|
|
"/",
|
|
@@ -60,6 +60,10 @@ func isNoAuthPath(path string) bool {
|
|
|
"/rest/svc/lang", // Required to load language settings on login page
|
|
|
}
|
|
|
|
|
|
+ if metricsWithoutAuth {
|
|
|
+ noAuthPaths = append(noAuthPaths, "/metrics")
|
|
|
+ }
|
|
|
+
|
|
|
// Local variable instead of module var to prevent accidental mutation
|
|
|
noAuthPrefixes := []string{
|
|
|
// Static assets
|
|
@@ -115,7 +119,7 @@ func (m *basicAuthAndSessionMiddleware) ServeHTTP(w http.ResponseWriter, r *http
|
|
|
}
|
|
|
|
|
|
// Exception for static assets and REST calls that don't require authentication.
|
|
|
- if isNoAuthPath(r.URL.Path) {
|
|
|
+ if isNoAuthPath(r.URL.Path, m.guiCfg.MetricsWithoutAuth) {
|
|
|
m.next.ServeHTTP(w, r)
|
|
|
return
|
|
|
}
|