Jump to >

djblets.http.middleware

Middleware for HTTP-related processing.

class AbsoluteURLRedirectMiddleware[source]

Bases: object

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:
Returns:

The resulting HTTP response.

Return type:

django.http.HttpResponse