Fixes: fix ALLOWED_HOSTS

This commit is contained in:
Egor Pavlovich Gorbunov 2025-06-05 19:23:10 +03:00
parent 39f5d19f9b
commit 8db354c85a

View file

@ -69,7 +69,20 @@ class BlockInvalidHostMiddleware:
self.get_response = get_response
def __call__(self, request):
allowed_hosts = getenv("ALLOWED_HOSTS").split(" ")
allowed_hosts = ["app:8000",
"worker:8000",
"beat:8000",
"localhost:8000",
"api.localhost:8000",
"b2b.localhost:8000",
"127.0.0.1:8000",
"api.127.0.0.1:8000",
"b2b.127.0.0.1:8000"]
if DEBUG:
allowed_hosts += ["*"]
else:
allowed_hosts += getenv("ALLOWED_HOSTS").split(" ")
if not hasattr(request, "META"):
return BadRequest("Invalid Request")
if DEBUG: