[FIX] Proper HTTPS detection

Fixes #1618 once merged
[FIX] HTTPS detecion on Template