Skip to content

Commit bcc0005

Browse files
committed
Except DisallowedHost in request span attributes
1 parent 12735a9 commit bcc0005

File tree

1 file changed

+5
-1
lines changed
  • plain/plain/internal/handlers

1 file changed

+5
-1
lines changed

plain/plain/internal/handlers/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from opentelemetry import baggage, trace
55
from opentelemetry.semconv.attributes import http_attributes, url_attributes
66

7-
from plain.exceptions import ImproperlyConfigured
7+
from plain.exceptions import DisallowedHost, ImproperlyConfigured
88
from plain.logs.utils import log_response
99
from plain.runtime import settings
1010
from plain.urls import get_resolver
@@ -78,6 +78,10 @@ def get_response(self, request):
7878
except KeyError:
7979
# Missing required WSGI environment variables (e.g. in tests)
8080
pass
81+
except DisallowedHost:
82+
# Invalid host header - skip URL_FULL for telemetry but let the
83+
# exception be handled normally by middleware for proper 400 response
84+
pass
8185

8286
# Add query string if present
8387
if query_string := request.meta.get("QUERY_STRING"):

0 commit comments

Comments
 (0)