Handle both http and https