When redirecting, don't trust the self.scheme to select the scheme (for reasons explained in #2553 and #3208), but rather use the base_url information derived from the trac.ini. This fixes #2553 by applying pkoelle's patch. This is probably not the last word on the matter though, because of #5064.