Answer the question
In order to leave comments, you need to log in
How to overcome "Referer checking failed" in Django 3?
I implement an API on the site, which is accessed by one of the services. But it doesn't send a referer. The site is on https, and django 3 introduced referer checking on requests. csrf_exempt doesn't help.
class SomeView(APIView):
permission_classes = (AllowAny,)
def post(self,request):
pass
Answer the question
In order to leave comments, you need to log in
CSRF_TRUSTED_ORIGINS
# settings.py
CSRF_TRUSTED_ORIGINS = ['api.yoursite.ru']
Which side of csrf_exempt to the referrer?
Can you provide the exact and complete text of the error?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question