Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django admin panel deploy on server Forbidden (403) CSRF verification failed. Request aborted

I'm on course Test-Driven Development with Django, Django REST Framework, and Docker (Michael Herman). My problem is that in a locally running container, the admin panel opens without problems, but the container placed on heroku gives an error (Forbidden (403) CSRF verification failed. Request aborted.) .. Where to look? Thanks!

like image 220
rotor1812 Avatar asked Mar 09 '26 07:03

rotor1812


1 Answers

I found a solution. The fact is that in Django 4.0 you need to add CSRF_TRUSTED_ORIGINS=['https://*.YOUR_DOMAIN.COM'] to settings.py

Thanks to Zeedia:

  • https://stackoverflow.com/a/70572093/18351480
like image 51
rotor1812 Avatar answered Mar 11 '26 07:03

rotor1812



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!