How to modify redirect in django middleware

I have a requirement to convert http to https if the redirect (HttpResponseRedirectBase) happens in django. So I'd like to write a middleware to handle that. I have put the middleware in the top of the middleware list, hope that's correct.I have used the following sample code. But when redirect happens, the url is not the full url, but relative url. So I don't know how to overwrite the url or schema(http or https). I have thought I could replace the http to https in the response, but the content of the response is also empty. So what should I do?

class RedirectFilter(object):
    def process_response(self, request,response):
        print 1111111111111
        print response.status_code
        print request.path
        print response.__class__.__name__
        if isinstance(response,HttpResponseRedirectBase):
            print response.url
            print response.content
        return response