Fix HTTP->HTTPS redirect

Ensure that clients arriving on HTTP maintain the same hostname when redirected to HTTPS.

Also reduces some inconsistencies between Vagrant and "real".