Add middleware for turning relative URL redirects into absolute URLs.
Review Request #10256 — Created Oct. 21, 2018 and submitted
Django 1.9 changed the behavior of URL redirects to always make them
relative if pointing to the same host. In theory, this is against RFCs
and can break some HTTP implementations out there, but in practice the
only real problem for us is that it makes it much harder to write unit
tests that cover 1.9+ and pre-1.9 versions of Django.This change introduces
AbsoluteURLRedirectMiddleware
, which will turn
those relative URLs back into absolute URLs, giving us the legacy
behavior. Sites/applications can use this until they're fully ready to
adopt the newer behavior of URL redirects.
Tested this with Review Board. Verified the URLs were coming back as
absolute in all cases.