Fix untested(?) deployment code for HTTPS support.

Addresses #409, #419, #307.