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.

When you run the playbook, it will look like this: 

image.png

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:

image.png

To fix this, change the domain to in the NetBox Global Settings:

image.png

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'])


Revision #4
Created 2024-09-22 20:53:46 UTC by Richard Foster
Updated 2024-10-09 14:01:31 UTC by Richard Foster