Reputation: 21
I have a problem with CSRF-token error in django+nginx+gunicorn in docker:
Origin checking failed - http://185.255.132.54:5000 does not match any trusted origins. Such problem on live production server and this problem with dev local server: Forbidden (403) CSRF verification failed. Request aborted.
This error appears only with NGINX port (any POST form, login page too (example.com/admin) (5000 for production and 8001 on dev server), but it's ok on gunicorn port (no static).
I read some that I have to add CSRF_TRUSTED_ORIGINS = ['http://185.255.132.54:5000', 'http://185.255.132.54', 'https://185.255.132.54:5000'] to production server, but it didn't help.
Here's my code: https://github.com/endlessnights/DjangoDockerNginxSample (all files, included Dockerfile, docker-compose, project files etc are there)
What have I to do with such problem?
Upvotes: 2
Views: 1145