manually handle http to https redirection