Django CSRF port wildcard

I am running a Django project in a container that defaults to expose the app on port 80, but due to specifics of my configuration that port is in use and I have it remapped to 8080. This breaks the app because the CSRF_TRUSTED_ORIGINS contains http://localhost but not http://localhost:8080. I want to allow any port from localhost, so I instead tried http://localhost:* (and also http://localhost:) but I'm getting a CSRF error with this config telling me that http://localhost:8080 isn't in the allowed host list.

I see directions for wildcard domains in the CSRF configuration directions, but nothing for wildcard ports. How can I accept any requests from localhost, regardless of port?

Вернуться на верх