From 50502fd6fa900d87fb3a7bc0ac18db0b24b56963 Mon Sep 17 00:00:00 2001 From: Michael Anstis Date: Tue, 28 May 2024 16:50:46 +0100 Subject: [PATCH] AAP-23414: Lightspeed onprem to block the metrics endpoint from public access. Fix URL (#1071) Co-authored-by: Michael Anstis --- ansible_wisdom/main/urls.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible_wisdom/main/urls.py b/ansible_wisdom/main/urls.py index b16a453ff..1365c36aa 100644 --- a/ansible_wisdom/main/urls.py +++ b/ansible_wisdom/main/urls.py @@ -64,7 +64,9 @@ path('', HomeView.as_view(), name='home'), # add the GitHub OAuth redirect URL /complete/github-team/ path('', include('social_django.urls', namespace='social')), - path('metrics/', MetricsView.as_view(), name='prometheus-metrics'), + # Do not add a trailing slash. django_prometheus uses plain /metrics + # Adding a trailing slash breaks our metric collection in all sorts of ways. + path('metrics', MetricsView.as_view(), name='prometheus-metrics'), path('admin/', admin.site.urls), path(f'api/{WISDOM_API_VERSION}/ai/', include("ansible_ai_connect.ai.api.urls")), path(f'api/{WISDOM_API_VERSION}/me/', CurrentUserView.as_view(), name='me'),