F5 BIG-IP LTM Specialist: Maintain and Troubleshoot — Question 193
A customer needs to intercept all of the redirects its application is sending to clients. When a redirect is matched, the customer needs to log a message including the client IP address.
Which iRule should be used?
Answer options
- A. when HTTP_RESPONSE { if { [HTTP::is_3xx] } { log local0. "redirecting client ip address [IP::addr [IP::remote_addr]]" } }
- B. when HTTP_REQUEST { if { [HTTP::is_301] } { log local0. "redirecting client ip address [IP::addr [IP::remote_addr]]" } }
- C. when HTTP_REQUEST { if { [HTTP::is_redirect] } { log local0. "redirecting client ip address [IP::addr [IP::remote_addr]]" } }
- D. when HTTP_RESPONSE { if { [HTTP::is_redirect] } { log local0. "redirecting client ip address [IP::addr [IP::remote_addr]]" }
Correct answer: D
Explanation
The correct answer is D because it triggers on HTTP_RESPONSE events, specifically checking if the response is a redirect. The other options either check for the wrong event type (like HTTP_REQUEST) or do not capture all redirects accurately.