allow to disable redirect
This commit is contained in:
parent
a4a0fa4f8b
commit
6c884b7804
2 changed files with 3 additions and 3 deletions
|
@ -6,12 +6,11 @@ from urllib.parse import urlparse
|
|||
class PrimaryDomainRedirectMiddleware:
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
# Parse the primary hostname from WEBSITE_URL
|
||||
self.primary_host = urlparse(settings.WEBSITE_URL).netloc
|
||||
self.disable_redirect = settings.DISABLE_REDIRECT
|
||||
|
||||
def __call__(self, request):
|
||||
# Skip redirects in DEBUG mode
|
||||
if settings.DEBUG:
|
||||
if settings.DEBUG or self.disable_redirect:
|
||||
return self.get_response(request)
|
||||
|
||||
# Check if the host is different from the primary host
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue