handle https and http