use https if a key is provided