From ffd1229714d58ff9877b0c6f40756aced4c9bad6 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 27 Mar 2024 23:23:15 +1100 Subject: [PATCH] Remove port from ALLOWED_HOST entries (#6871) --- InvenTree/InvenTree/settings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index fd660451ba..539aa4f9a1 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -1017,7 +1017,10 @@ if not ALLOWED_HOSTS: # Ensure that the ALLOWED_HOSTS do not contain any scheme info for i, host in enumerate(ALLOWED_HOSTS): if '://' in host: - ALLOWED_HOSTS[i] = host.split('://')[1] + ALLOWED_HOSTS[i] = host = host.split('://')[1] + + if ':' in host: + ALLOWED_HOSTS[i] = host = host.split(':')[0] # List of trusted origins for unsafe requests # Ref: https://docs.djangoproject.com/en/4.2/ref/settings/#csrf-trusted-origins