Set secure cookies when in "HTTPS" mode only (not in "http" or "http+https")

Ticket: #6916

Teach certificates how to serial!

Ticket: #6928