Added secure redirect middleware