More fixes for https redirect. Don't push this yet...