Simple HTTP info page for your devs
Problem this snippet solves:
When implementing a virtual server in a complex multi fire-walling / natting environment, it is useful to reflect the details of a request back to a developer, as opposed to constantly having to supply other departments with the output of /var/log/ltm, or even worse giving non-F5 personnel access to the device.
Herewith a very small < 20 lines (in case I can enter 20 or less) irule that responds with everything I can think of gathering as far as request is concerned, in a sort of legible html format, with auto refresh...
How to use this snippet:
Apply to a virtual server with an http profile..
Code :
when HTTP_REQUEST { set response "This is a client info request response
" append response "Virtual Server Information Virtual server: [virtual name]
Backend Pool: [LB::server pool]
" append response "IP Information Client IP: [IP::client_addr]
IP hops: [IP::hops]
IP Idle Timeout: [IP::idle_timeout]
IP TTL: [IP::ttl]
Stats
Bytes in:\ [IP::stats bytes in]
Bytes out:\ [IP::stats bytes out]
" append response "TCP Information TCP client source port: [TCP::client_port]
TCP mss: [TCP::mss]
TCP round-trip-time: [TCP::rtt]
" append response "HTTP Information HTTP method: [HTTP::method]
HTTP uri:Client request headers
" if {[HTTP::header exists "Content-Length"] } { HTTP::collect [HTTP::header "Content-Length"] } else { HTTP::collect 1048576 } append response "Client request payload: [HTTP::payload]" HTTP::respond 200 -version 1.1 content $response Cache-Control no-cache }
" foreach header [HTTP::header names] { append response " $header: [HTTP::header value $header]
"} append response "Tested this on version:
11.6