I have a PHP script running on an Apache server which is responsible for disconnecting all user sessions.
For that, it makes a loop that identifies itself as the session that should be disconnected and destroys it. This procedure has no echo.
The Apache log returns HTTP code 200, saying that everything went well.
But NGINX returns the following error.
[error] 512#512: *2699 upstream sent too big header while reading response header from upstream, client: <public-ip>, server: server01.example.com, request: "GET /tste.php HTTP/1.1", upstream: "http://192.168.50.2:80/tste.php", host: "server02.example.com"
What can cause this problem?
PHP script:
<?php
error_reporting(-1);
ini_set('display_errors', 1);
if (!function_exists('deleteSession')) {
function deleteSession($targetSessionID)
{
// 1. commit session if it's started.
if (session_id()) {
session_commit();
}
// 2. store current session id
session_start();
$current_session_id = session_id();
session_commit();
// 3. hijack then destroy session specified.
session_id($targetSessionID);
session_start();
session_destroy();
session_commit();
// 4. restore current session id. If don't restore it, your current session will refer to the session you just destroyed!
session_id($current_session_id);
session_start();
session_commit();
}
}
$sessions = [
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj',
'soadjasjosldjsaoidjasoijdsajdsaj'
];
foreach ($sessions as $session) {
deleteSession($session);
}