sentry: Ignore DisallowedHost messages.

This is a misconfiguration of the client, not the server.
This commit is contained in:
Alex Vandiver
2020-08-08 00:39:07 -07:00
committed by Tim Abbott
parent f00ff1ef62
commit 28c627452f

View File

@@ -384,6 +384,10 @@ class FlushDisplayRecipientCache(MiddlewareMixin):
return response
class HostDomainMiddleware(MiddlewareMixin):
def __init__(self, get_response: Callable[[Any, WSGIRequest], Union[HttpResponse, BaseException]]) -> None:
super().__init__(get_response)
ignore_logger("django.security.DisallowedHost")
def process_request(self, request: HttpRequest) -> Optional[HttpResponse]:
# Match against ALLOWED_HOSTS, which is rather permissive;
# failure will raise DisallowedHost, which is a 400.