docker-openwisp icon indicating copy to clipboard operation
docker-openwisp copied to clipboard

Allow setting CSRF_TRUSTED_ORIGINS via .env

Open jangrewe opened this issue 1 year ago • 2 comments

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 avatar May 23 '24 23:05 jangrewe

@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.

nemesifier avatar May 24 '24 02:05 nemesifier

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. 😉

jangrewe avatar May 24 '24 08:05 jangrewe

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.

nemesifier avatar Jul 22 '24 16:07 nemesifier