Wagtail: Intermittent CSRF Verification Error - django

When saving a draft, I have been getting a "CSRF verification failed. Request aborted." error. It happens only intermittently, trying a couple of times to save the draft usually works. I am running Wagtail 2.2.2 and Django 2.0.3, and I have 'django.middleware.csrf.CsrfViewMiddleware' in my settings.py file. Here is the error message:
Forbidden (403)
CSRF verification failed. Request aborted.
Reason given for failure:
CSRF token missing or incorrect.

This is due to a custom implementation of Shibboleth my organization uses for authentication. It seems that if I previewed a page before saving the draft, the CSRF token was changed by Django, which Shib did not like. In our own code, we extend RemoteUserMiddleware to use with Shib. So, we changed that to PersistentRemoteUserMiddleware and it seems to be working now.

Related

csrf missing error but csrf token is present there i have checked it by inspecting it it is happen in cpanel deployment

Forbidden (403)
CSRF verification failed. Request aborted.
You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties.
If you have configured your browser to disable cookies, please re-enable them, at least for this site, or for “same-origin” requests.
More information is available with DEBUG=True.
In my django project when i deploy it to c panel its form submission giving me error i have already inclued the csrf token and also it is working perfectly fine during the development i did some research they were talking about the render function i have used redirect and i had to use

CSRF Cookie error with Chrome browser that I cannot solve

I'm using javascript with a Django api to submit a modal form.
I'm sending a CSRF cookie that works in other circumstances (like on other browsers or with other forms in Chrome), but when I submit a Django form, but it fails on chrome and I get the following error:
Error:
Forbidden (403) CSRF verification failed.
Request aborted.
Reason given for failure: CSRF token missing or incorrect.
I know for a fact that I'm sending the CSRF cookie, as I can see it in the inspect element.
csrfmiddlewaretoken=*sometoken*
How might I fix this and what other information do you need?

Forbidden (403) CSRF verification failed. Request aborted. Django Admin

I've been using the Django admin panel for my project the entire time and suddenly after I cleaned my cookies it just won't work again it keep sending me this error:
Forbidden (403) CSRF verification failed. Request aborted.
Help:
Reason given for failure:
CSRF token missing or incorrect.
I am answering this question from the very less information available.
When you delete your cookies, the session-key stored on your browser side will be deleted. This way any API calls made after that will result in 403 error. Just to make sure this is correct, you can open your incognito tab in google chrome and try the same request after logging in.

django: after upgrade to 1.2 CSRF raises 403 though I don't have CSRF protection enabled

I have just upgraded to Django 1.2 and I am trying to run my project. After I login I get
Forbidden (403)
CSRF verification failed. Request aborted.
which is strange because I haven't enabled CSRF protection previously. Do I have to configure something else to have my project work?
Yep, that's because you use contrib.admin view for login with a custom template. You should add csrf_token to your login template.
It seems, that CSRF protection is on for contrib.admin views, which I use for login. This is why I get 403.

IPN delivery failed. HTTP error code 403: Forbidden

I am trying to test IPN. Working with django-paypal. What could be wrong.
The URL is working. No errors otherwise...
But when I test this, it says IPN delivery failed and error code is 403,
Same problem on my site. Turns out that when telneting the server, I get the following details concerning the 403:
Forbidden (403)
CSRF verification failed. Request aborted.
Hooray, the csrf validation works ;D Now i gotta figure out how to turn it off for this particular form. Hope this hint helps anyone encountering the 403 when using django-paypal.
Do you have your website password protected? It sounds like paypal is getting a 403 response from your webserver. Make sure paypal can get to your website without requiring basic auth or something like that.