added check for http or https