Allow setting CSRF_TRUSTED_ORIGINS via .env
I have just set up the whole OpenWISP stack with the edge images and got this error:
Forbidden (Origin checking failed - https://openwisp.faked.org/ does not match any trusted origins.): /admin/login/
(It worked fine with the latest images.)
There is a fix mentioned in ansible-openwisp2: https://github.com/openwisp/ansible-openwisp2/issues/443
But editing the settings.py is not that easy with Docker images, for as a workaround i'm mounting a fixed settings.py into the Dashboard container - and then it works.
It would be great if setting CSRF_TRUSTED_ORIGINS via the .env file would be possible, similar to how DJANGO_ALLOWED_HOSTS is already handled.
Thanks!
@jangrewe I am open to adding this. In the meantime, this should let you define custom settings: https://github.com/openwisp/docker-openwisp?tab=readme-ov-file#custom-django-settings.
Oh snap, ich completely forgot about that, because when doing my "docker-compose.yml to custom Ansible role" thing, i didn't add that bind mount because i though "nah, i won't be needing that..." - shame on me! 🫣
But thanks for adding this anyways, as it seems to be not a one-off situation that this needs to be set. 😉
I think the docs about customizing settings is good enough for this, hence I'm closing. BTW: the docs for advanced customizations are being moved to the Unified Documentation Website.