Fix https redirection bug