Some browsers already implement the
Referrer Policy draft, which gives the developer more control over the referer HTTP header sent by the browser. Sometimes is useful to set a more private policy, like
Origin When Cross-Origin, to prevent disclosing sensitive URL info to a third-party, like a password reset token for example.
But one can't just set the policy to
Origin When Cross-Origin, because it will break on Safari, since Safari doesn't adhere to newest spec and defaults to no-referrer, which breaks form submits on HTTPS because of Django strict referrer check. Also, I can't imagine now why, but some developer might want to disable referer header altogether, and can easily do so by setting policy to
No Referrer. See the
rationale behind strict referrer check and the
code.
Maybe Django shouldn't do do strict referrer check anymore?
It's very strange to change a HTML meta tag and break everything. And break in staging specifically, because this happens only on secure requests.
If Django
still needs the strict referrer check, maybe a better error message should be implemented.