0001-multitenant-always-return-200-on-fake-health.check-t.patch
hobo/multitenant/middleware.py | ||
---|---|---|
5 | 5 |
from django.utils.encoding import smart_bytes |
6 | 6 |
from django.conf import settings |
7 | 7 |
from django.db import connection |
8 |
from django.http import Http404, HttpResponseRedirect |
|
8 |
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
|
9 | 9 |
from django.contrib.contenttypes.models import ContentType |
10 | 10 |
from tenant_schemas.utils import get_tenant_model, get_public_schema_name |
11 | 11 | |
... | ... | |
62 | 62 |
connection.set_schema_to_public() |
63 | 63 |
hostname_without_port = request.get_host().split(':')[0] |
64 | 64 | |
65 |
if hostname_without_port == 'health.check': |
|
66 |
# allow for special health.check domain name for haproxy |
|
67 |
# availability checks. |
|
68 |
return HttpResponse('health ok', content_type='text/plain') |
|
69 | ||
65 | 70 |
try: |
66 | 71 |
request.tenant = self.get_tenant_by_hostname(hostname_without_port) |
67 | 72 |
except TenantNotFound: |
68 |
- |