Forum Discussion
Irule and regex inspired from apache like regex
Hi,
I'm migrating a reverse proxy apache conf to BigIP. I had powerful line that matches 192 urls cases. The issue is that the best i've found until now, is really not convenient at all with BigIP. I'm actually using an Irule that calls a DataGroup containing those 192 lines. Here's the apache line : RewriteRule ^/A(B|C)DEF/test-(10|20|30|40|50|60)/(one|two|three|four|five|six|seven|eight)/(2013|2014)/(.) This can handle (2682 = 192 cases) in one line. In my BigIP configuration, i had to use DataGroups and write down all those cases. Does anyone think about another way to manage this without Datagroups ?
Thanks a lot for any help Aurel
- What_Lies_Bene1Cirrostratus
What are you looking to actually do on a match and can I assume you're looking to match the URI? I'd imagine the 'matches_regex' command would work well here.
- Kevin_StewartEmployee
Agreed. Something like this:
when HTTP_REQUEST { if { [HTTP::uri] matches_regex {^/A(B|C)DEF/test-(10|20|30|40|50|60)/(one|two|three|four|five|six|seven|eight)/(2013|2014)/(.)} } { log local0. "match" } else { log local0. "no match" } }
- AurelCirrus
Hi Kevin, Thanks a lot for your reply. Yes, it is about URI matches. Your code looks perfect. I also need to rewrite, do you maybe know how to get the following ?
http://webserver_name-$2-A$1DEF/$4/$5
- Kevin_StewartEmployee
I don't think a lookahead/back reference will work with matches_regex, but this will:
if { [regexp {^/A(B|C)DEF/test-(10|20|30|40|50|60)/(one|two|three|four|five|six|seven|eight)/(2013|2014)/(.)} $uri all a b c d e] == 1 } { log local0. "http://webserver_name-${b}-A${a}DEF/${d}/${e}" }
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