Added auto http/https detection