I tried changing redirect to send and the correct destination was showing in the browser.
I couldnt get the req.get to provide any data . I did notice from the {{$_SERVER}} command that Apple suggested I try that the
'x-forwarded-proto'
should be(?)
'HTTP_X_FORWARDED-PROTO'
Ah, that was a stupid mistake in my code, it should exit (return) the function after the next() is called otherwise it will always execute the redirect code.