Fixes: fix ALLOWED_HOSTS
This commit is contained in:
parent
39f5d19f9b
commit
8db354c85a
1 changed files with 14 additions and 1 deletions
|
|
@ -69,7 +69,20 @@ class BlockInvalidHostMiddleware:
|
||||||
self.get_response = get_response
|
self.get_response = get_response
|
||||||
|
|
||||||
def __call__(self, request):
|
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"):
|
if not hasattr(request, "META"):
|
||||||
return BadRequest("Invalid Request")
|
return BadRequest("Invalid Request")
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue