diff --git a/src/sentry/api/urls.py b/src/sentry/api/urls.py index a9ce5ce97d1a0f..134a660fed9249 100644 --- a/src/sentry/api/urls.py +++ b/src/sentry/api/urls.py @@ -1334,6 +1334,7 @@ method_dispatch( GET=OrganizationMonitorCheckInIndexEndpoint.as_view(), POST=MonitorIngestCheckInIndexEndpoint.as_view(), # Legacy ingest endpoint + csrf_exempt=True, ), name="sentry-api-0-organization-monitor-check-in-index", ), diff --git a/src/sentry/api/utils.py b/src/sentry/api/utils.py index fef149b6586f72..4da2818027e536 100644 --- a/src/sentry/api/utils.py +++ b/src/sentry/api/utils.py @@ -9,6 +9,7 @@ from django.http import HttpResponseNotAllowed from django.utils import timezone +from django.views.decorators.csrf import csrf_exempt from rest_framework.request import Request from sentry import options @@ -283,4 +284,7 @@ def dispatcher(request, *args, **kwargs): # type: ignore[no-untyped-def] handler = dispatch_mapping.get(request.method, invalid_method) return handler(request, *args, **kwargs) + if dispatch_mapping.get("csrf_exempt"): + return csrf_exempt(dispatcher) + return dispatcher