Forum Discussion
iRULE to troubleshoot cookie
The application required stickness so we configured cookie presistance , sometimes its throwing 500 error page but its working perfectly with source_address presistance so we need to troubleshhot the cookie whether its keeping stickness .I want to log the floowing to troubleshoot , please help to correct me if its correct logic and syntax
1)log the client ip address and X-Forwarded-for 2)log whether request has "LB_PRODREG_PRD" cookie exist or not 3)log the request sent to which LB server 4log the resonse code and throw if the its has 500 error
3 Replies
- velumanidevf5_2
Nimbostratus
when CLIENT_ACCEPTED {
log local0. "[IP::client_addr]:[TCP::client_port]: New TCP connection to [IP::local_addr]:[TCP::local_port]" log local0. "X-Forwarded-For: [HTTP::header X-Forwarded-For]" }
when HTTP_REQUEST {
set hostvar [HTTP::host] set urivar [HTTP::uri] set ipvar [IP::client_addr] if {[HTTP::cookie exists "LB_PRODREG_PRD"]}{
log local0. "[IP::client_addr]:[TCP::client_port]: Request with persistence cookie [HTTP::cookie value "LB_PRODREG_PRD"] to [HTTP::host][HTTP::uri]"
} else {
log local0. "[IP::client_addr]:[TCP::client_port]: Request contains NO persistence cookie to [HTTP::host][HTTP::uri]" }
}
when LB_SELECTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Request sent to [LB::server]"
}
when LB_FAILED {
log local0. "[IP::client_addr]:[TCP::client_port]: Request failed to [LB::server]"
}
when HTTP_RESPONSE { set responsecode [HTTP::status] log local0. "Response code is $responsecode" if { [HTTP::status] eq 500 } { log local0. "$ipvar requested $hostvar $urivar and received a 500 from [IP::server_addr]" } } In general they look OK. Move following line:
log local0. "X-Forwarded-For: [HTTP::header X-Forwarded-For]"
under HTTP_REQUEST event.I don't see any loop scenario. There is always some CPU cycle utilized with iRule execution. After your troubleshooting efforts, you should detach iRule.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com