You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just testing the metrics.net library, curious if one can put authentication on the metrics endpoint? Below is our snippet in the configuration() method. What am I missing? My controller is expecting basic authentication but the metrics endpoint is allowing me to go to it.
appBuilder.Use(typeof(AuthenticationMiddleware));
appBuilder.UseCors(CorsOptions.AllowAll);
Metric.Config
.WithAllCounters()
//.WithReporting(r => r.WithConsoleReport(TimeSpan.FromSeconds(30)))
.WithOwin(m => appBuilder.Use(m), cfg => cfg
.WithRequestMetricsConfig(c => c.WithAllOwinMetrics(), new[]
{
new Regex("(?i)^sampleignore"),
new Regex("(?i)^metrics"),
new Regex("(?i)^health"),
new Regex("(?i)^json")
})
.WithMetricsEndpoint()
);
HttpConfiguration config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
appBuilder.UseWebApi(config);
The text was updated successfully, but these errors were encountered:
You are creating Metrics endpoint using Owin. Metrics is just one of the Owin handlers. For each request, Owin handlers are called in the order of registration. So problem is probably in your AuthenticationMiddleware not stopping the request before it reaches Metrics middleware...
Just testing the metrics.net library, curious if one can put authentication on the metrics endpoint? Below is our snippet in the configuration() method. What am I missing? My controller is expecting basic authentication but the metrics endpoint is allowing me to go to it.
The text was updated successfully, but these errors were encountered: