Forum Discussion
AP_5759
Nimbostratus
Jun 15, 2017Help with iRules and URI redirection
Hello everyone. I am looking for help with irule design to perform the following: remove "services" from uri and forward traffic to a specific pool as following
http://dev.api.company.com/services/nameofservice1
http://dev.api.company.com/services/nameofservice2
http://dev.api.company.com/services/nameofservice3
http://dev.api.company.com/services/nameofservice4
http://dev.api.company.com/services/nameofservice5
pool1_8888
pool2_8889
pool3_8890
pool4_8891
pool5_8892
dev.api.company.com/services/nameofservice1 ==> dev.api.company.com/nameofservice1 ==> pool1_8888
dev.api.company.com/services/nameofservice2 ==> dev.api.company.com/nameofservice2 ==> pool2_8889
dev.api.company.com/services/nameofservice3 ==> dev.api.company.com/nameofservice3 ==> pool3_8890
dev.api.company.com/services/nameofservice4 ==> dev.api.company.com/nameofservice4 ==> pool4_8891
dev.api.company.com/services/nameofservice5 ==> dev.api.company.com/nameofservice5 ==> pool5_8892
Any help and/or assistance will be greatly appreciated. Thank you all.
- AP_5759
Nimbostratus
Sorry, forgot to add.. I need to perform the port translation. The browser should not see theother ports except of 80. Thank you again.
- Vijay_E
Cirrus
This should provide a rough idea. Create a datagroup: CLASS_URI_POOL
/services/nameofservice1:=pool1_8888 /services/nameofservice2:=pool2_8889 /services/nameofservice3:=pool3_8890 /services/nameofservice4:=pool4_8891 /services/nameofservice5:=pool5_8892 when HTTP_REQUEST { set POOL [class match -value $URI contains CLASS_URI_POOL] if { $POOL eq "" } { HTTP::uri [string map {/services/ /} [HTTP::uri]] pool $POOL } }
- AP_5759
Nimbostratus
Appreciate a prompt response. I will modify this rule and will give it a try.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects