101 · Question #47
A virtual server at 10.10.1.100:80 has the rule listed below applied. when HTTP_REQUEST { if {[HTTP::uri] ends_with "htm" } { pool pool1 } elseif {[HTTP::uri] ends_with "xt" } { pool pool2 } If a
The correct answer is B. pool2. The iRule routes requests to pool2 when the URI ends with 'xt', which matches a URI such as 'file.txt' because 'txt' ends with 'xt'.
Question
A virtual server at 10.10.1.100:80 has the rule listed below applied. when HTTP_REQUEST { if {[HTTP::uri] ends_with "htm" } { pool pool1 } elseif {[HTTP::uri] ends_with "xt" } { pool pool2 } If a
Options
- Apool1
- Bpool2
- CNone. The request will be dropped.
- DUnknown. The pool cannot be determined from the information provided.
How the community answered
(55 responses)- A5% (3)
- B80% (44)
- C4% (2)
- D11% (6)
Why each option
The iRule routes requests to pool2 when the URI ends with 'xt', which matches a URI such as 'file.txt' because 'txt' ends with 'xt'.
pool1 is only selected when the URI ends with 'htm'; a URI ending in 'xt' does not satisfy that first condition and therefore bypasses pool1.
The second condition in the iRule checks whether the HTTP URI ends with the string 'xt'. A URI such as 'document.txt' satisfies this condition because the last two characters are 'xt', causing the LTM to direct the request to pool2.
The request is not dropped because the second elseif condition matches a URI ending in 'xt' and provides an explicit pool assignment, so the connection is forwarded normally.
The pool can be determined from the iRule logic - the 'xt' suffix match in the elseif branch unambiguously selects pool2 for the described request.
Concept tested: F5 iRule URI string matching and pool selection
Source: https://clouddocs.f5.com/api/irules/HTTP__uri.html
Topics
Community Discussion
No community discussion yet for this question.