Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How secure is a header redirect? Can it be bypassed?

How secure are header redirects? As I understand it, the header information instructs the browser what to do. Therefore, if the header location is set to some other place, can the browser still be made to land on the initial page?

if(!$loggedin){
header('Location: someotherpage.php')
}

If someone, (cough cough) forgot to use an exit command after the header, could someone still land on that page?

like image 881
Altimus Prime Avatar asked Feb 22 '12 23:02

Altimus Prime


1 Answers

If someone, (cough cough) forgot to use an exit command after the header, could someone still land on that page?

Sure - rather than land on that page (which he already has), forgetting an exit() means the client can still see any data emitted after those lines. Nobody can force the client to leave immediately after receiving a Location: header. That action is entirely voluntary.

like image 76
Pekka Avatar answered Oct 19 '22 22:10

Pekka