Fixes bug that precvented session key to work when multiple ntopng instances are started per host

This commit is contained in:
Luca Deri 2021-05-21 23:29:15 +02:00
parent ce5bfa7af7
commit d81d8a3295
10 changed files with 61 additions and 30 deletions

View file

@ -243,6 +243,7 @@ local http_status_code_map = {
function sendHTTPHeaderIfName(mime, ifname, maxage, content_disposition, extra_headers, status_code)
info = ntop.getInfo(false)
-- tprint(info)
local cookie_attr = ntop.getCookieAttributes()
local lines = {
'Cache-Control: max-age=0, no-cache, no-store',
@ -255,7 +256,8 @@ function sendHTTPHeaderIfName(mime, ifname, maxage, content_disposition, extra_h
}
if(_SESSION ~= nil) then
lines[#lines + 1] = 'Set-Cookie: session='.._SESSION["session"]..'; max-age=' .. maxage .. '; path=/; ' .. cookie_attr
local key = "session_"..info.http_port.."_"..info.https_port
lines[#lines + 1] = 'Set-Cookie: '..key..'='.._SESSION["session"]..'; max-age=' .. maxage .. '; path=/; ' .. cookie_attr
end
if(ifname ~= nil) then