Forum Discussion
René_Posthumus
Dec 22, 2020Altostratus
Figured out myself using some other posts, i had to use CLIENT_ACCEPTED instead of SERVER_CONNECTED event. Now it works fine! 😀
So to be complete, this is the code:
when CLIENT_ACCEPTED {
set clientsourceport [TCP::client_port]
set curtime [clock seconds]
set formattedtime [clock format $curtime -format {%T} ]
set client_ip [IP::client_addr]
log local0. "Connection on $formattedtime from $client_ip with source port $clientsourceport."
}
when HTTP_REQUEST {
HTTP::header insert X-Client-Source-Port "$clientsourceport"
log local0. "Request headers [HTTP::request]"
}