Forum Discussion
C_D_18583
Nimbostratus
Jun 27, 2006Apache mapping and F5 Irules
Here is one Apache mapping using mod_rewrite.
/cgi-ads/jsp/viewitem.do?category=personal_services_local&Region=A http://at-consume.tsl.da.com:2200/telus-cp-portal-web/jsp/productcatalogue/person...
Jun 28, 2006
Ahh, you learn something new every day.
You can use store mappings in a datagroup. You can store both strings space delimited in the datagroup and use the findclass method to extract them.
check out the findclass docs for some examples:http://devcentral.f5.com/wiki/default.aspx/iRules.findclassClick here
Let's say you have these four mappings defined in a string datagroup (this is the bigip.conf rendering of the data group)
class redirects {
/cgi-ads/jsp/viewitem.do?category=personal_services_local&Region=A http://redirect1.com/path1
/cgi-ads/jsp/viewitem.do?category=personal_services_local&Region=B http://redirect2.com/path2
/cgi-ads/jsp/viewitem.do?category=personal_services_local&Region=C http://redirect3.com/path3
/cgi-ads/jsp/viewitem.do?category=personal_services_local&Region=D http://redirect4.com/path4
}You could then use the following to lookup the first key and extract the second.
when HTTP_REQUEST {
set my_redirect [findclass [HTTP::uri] $::redirects " "]
if { $my_redirect ne "" } {
HTTP::redirect $my_redirect
}
}Keep in mind that the findclass command is not case sensitive so if you need to worry about both upper and lower cases in requests, lowercase the strings in the datagroup and use the string tolower command on the HTTP::uri variable.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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