use https if cert and key provided