djblets.http.middleware¶
Middleware for HTTP-related processing.
- class AbsoluteURLRedirectMiddleware(get_response)[source]¶
Bases:
MiddlewareMixin
Middleware that turns all relative URL redirects to absolute.
Django 1.9 changed URL redirects to be relative by default (so long as they’re redirecting to the same host). For compatibility across Django versions (and to theoretically work around some broken HTTP implementations out in the wild), this middleware will turn those relative URLs back into absolute URLs.
- process_response(request, response)[source]¶
Process the HTTP response.
If a relative redirect was returned, this will make it absolute.
- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the client.response (
django.http.HttpResponse
) – The HTTP response to check.
- Returns:
The resulting HTTP response.
- Return type:
- __annotations__ = {}¶