adding correct check for http vs https