Forum Discussion
is it possible to log all header to html page
Hi Guys,
I try to use the irule to log all http headers when the request is coming to the VS, and then F5 generate the response page to the client.
I find the rule to log the all header to /var/log/ltm, and it's ok to log all header to /var/log/ltm :
- when HTTP_REQUEST {
- set LogString "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri]"
- log local0. "============================================="
- log local0. "$LogString (request)"
- foreach aHeader [HTTP::header names] {
- log local0. "$aHeader: [HTTP::header value $aHeader]"
- }
- log local0. "============================================="
- }
When i try to combine the another irule to let the F5 send the html, the page only display one header not all headers
The another irule is
when HTTP_REQUEST {
HTTP::respond 200 content {
<html><head><title>Test Page</title></head><body>
Here is your header information
</body></html>
}
}
And i combine two rules
when HTTP_REQUEST {
set LogString "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri]"
log local0. "============================================="
log local0. "$LogString (request)"
foreach aHeader [HTTP::header names] {
HTTP::respond 200 content "
<html>
<head>
<title>Test Page</title>
</head>
<body>
Your Request Header information: </BR>
HTTP method: $HTTP_Method </BR>
HTTP URI: $HTTP_URI </BR>
HTTP Path: $HTTP_Path </BR>
HTTP Query: $HTTP_Query </BR>
HTTP Version: $HTTP_Version </BR>
HTTP Host: $HTTP_Host </BR>
User Agent: $User_Agent </BR>
$aHeader: [HTTP::header value $aHeader]
</body>
</html> "
}
}
How can i combine those two rules to log all header to the response page.
Regards,
Ding