Changes to HTTP redirect

Fixes to redirect loop.