properly enable tls if https scheme detected