I have two sessions in PHP:
$_SESSION["session"]["key"] = md5 ($token . $userAgent . $ip);
$_SESSION["session"]["timeout"] = time ();
Just want to check that sessions with nginx, tried this code without success:
location / {
if ($request_filename ~* "index.php") {
break;
}
if ($http_cookie ~* "session") {
break;
}
rewrite ^.+$ https://localhost/index.php last;
}
Any clues ?
Thanks.
a cookie just holds the Session ID, an id is always created upon
session_start();so if your calling that within your script the user will always have a session id.your best bet is too add a second cookie:
then within nginx:
to check if that cookie is set.
If the hash is sensitive then do this:
Then in Nginx:
But this is still vulnerable , always check server side values match!