Use ssl when necessary