Bb 1545

Fixes various redirect issues

1) HTTP/HTTPS server redirects and HTTPS detection by Django is now fixed.
2) Redirects by Safari and IE9 are now fixed by appending the hash part in the location header.

Incidentally also fixes a broken migration that can not be executed with dry run enabled.