How to make different url aliases work for local django development

I am using django-tenants and created various aliases that all point to localhost.

If the local development server is reachable via http://localhost:8000/ and I can login to the admin as expected.

If I use e.g. http://other_url.local:8000/django-admin the login form is also presented but I get an error message: 403 Forbidden CSRF verification failes cookie not set.

How can I achieve testing for different clients locally without installing an nginx with different vhosts.
Settings:

CSRF_COOKIE_SAMESITE = None
CSRF_COOKIE_SECURE = False

Thanks and Regards

Add following settings:

CSRF_TRUSTED_ORIGINS = [
    "http://localhost:8000",
    "http://127.0.0.1:8000",
    "http://other_url.local:8000",
]
ALLOWED_HOSTS = ['localhost', '127.0.0.1', '.local']
Вернуться на верх