Forum Discussion
iRule redirection to different port
i have configured a web service as below
VIP : abc.com:443
pool members: 10.100.10.1:8843 10.100.10.2:8843
but i want to redirect if any user comes with extension "xyz" as https://abc.com/xyz then it will re-direct to another port i.e https://10.100.10.1:7143 .
is it like i have to create a different pool for port 7143 and will call this pool in irule under https://abc.com please let me know what iRule should be used.
- P_K
Altostratus
Creating a new pool and redirecting traffic based on your uri should work seamlessly.
when HTTP_REQUEST {
- kohli9harjeev
Nimbostratus
Hi,
You dont need to create a separate pool for it. You can just create a node for the same
when HTTP_REQUEST { if {[string tolower[HTTP::host] eq "abc.com"] && [string tolower[HTTP::uri] starts_with "xyz" ] } { node 10.100.10.1 7143 } else { pool default_pool } }
- Lee_Sutcliffe
Nacreous
Try adding a logging to see how the F5 is interpreting the request:
when HTTP_REQUEST { log local0. "URI:[HTTP::uri]" if { [HTTP::uri] starts_with "/xyz" } { node 10.202.100.1 7143 } else { pool Default_pool } }
- Lee_Sutcliffe
Nacreous
The iRule should be working as written. You could use tcpdump to confirm if traffic is getting sent to the node specified in the iRule.
tcpdump -nni 0.0 host 10.202.100.1
- Lee_Sutcliffe
Nacreous
You'll need to modify the log to output the URI that is captured in the else condition. Once a match is made in an 'if' statement it breaks out and stops processing further conditions so the 'else' should not be matched if it was previously matched in the preceding 'if'
when HTTP_REQUEST { if { [HTTP::uri] starts_with "/xyz" } { log local0. "If condition matched with URI:[HTTP::uri]" Pool abc_pool } else { log local0. "else condition matched with URI:[HTTP::uri]" pool Default_pool }
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