NetBox CSRF Settings
Introduction
This playbook netbox-csrf
will add your domains in the following format to the NetBox settings.py
file based on the DOMAIN
variable in Semaphore.
http://*.yourdomain.com
https://*.yourdomain.com
http://yourdomain.com
https://yourdomain.com
When you run the playbook, it will look like this:
Use Case
If your server name is uk-lab-nb01.core.netos.io
, and you configured a DNS CNAME to give it a more friendly name like demo2.netos.io
via a reverse proxy, then you would see this error and won't be able to login:
To fix this, change the domain to in the NetBox Global Settings:
Which will create a settings.py
file entry like this and fix the error:
CSRF_TRUSTED_ORIGINS = getattr(configuration, 'CSRF_TRUSTED_ORIGINS', ['http://netos.io', 'https://netos.io', 'http://*.netos.io', 'https://*.netos.io'])