Search code examples
djangodjango-admindjango-csrfcsrf-token

CSRF verification failed. Request aborted


Been working on my live server all day and just got it working, admin was working fine, i cleared cookies and suddenly i got the following error, and no fixes seem to be helping me. My website does have SSL yet so its still http(dont know if this has anything to do with it?) enter image description here

DEBUG = False
   
  CSRF_TRUSTED_ORIGINS = ['http://.*', 'http://example.com', 'http://www.example.com']


# HTTPS Settings
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = False
SECURE_SSL_REDIRECT = False

# HSTS Settings

SECURE_HSTS_SECONDS = 31536000
SECURE_HSTS_PRELOAD = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = True

This is the only form on my website that requires csrf_token and as you can see it already has it. enter image description here


Solution

  • SOLVED

    By adding the ip from my domain to the allowed hosts and trusted origins.