Forum Discussion

forsan's avatar
forsan
Icon for Altostratus rankAltostratus
May 13, 2014

ProxyPass iRule with regular expressions

Hi,

I have been asked to migrate the ProxyPass and ProxyPassReverse rules from the Apache to the BigIP. I found the following iRule here at DecCentral. https://devcentral.f5.com/wiki/iRules.proxypassv10.ashx

The issue is that its matching on simple rules like /foo/bar but not on regular expressions like ^(/(?:[a-zA-Z]{2}/[a-zA-Z]{2}|[a-z]{2})/fooo*.baar) that should match /SE/sv/fooo.baar and /se/fooo.baar

ltm virtual /PRD_www/andreas-www {
    destination /PRD_www/192.168.80.3:80
    ip-protocol tcp
    mask 255.255.255.255
    pool /PRD_www/test
    profiles {
        /Common/http { }
        /Common/oneconnect { }
        /Common/tcp { }
    }
    rules {
        /PRD_www/logging
        /PRD_www/ProxyPass
    }
    source 0.0.0.0/0
    translate-address enabled
    translate-port enabled
    vlans-disabled
}

 ltm data-group internal /PRD_www/ProxyPass {
    records {
        "^(/(\?:\[a-zA-Z]{2}/\[a-zA-Z]{2}|\[a-z]{2})/fooo\*\\.baar)" {
            data "http://test-www.baar.com$1 systst2-ext"
        }
        /foo/bar/ {
            data "http://test-www.baar.com/foo/bar/ systst2-ext"
        }
    }
    type string
}

output from log is:

May 13 11:18:50 andreas info tmm[9337]: Rule /PRD_www/ProxyPass : VS=/PRD_www/andreas-www, Host=192.168.80.3, URI=/se/fooo.baar: No rule found, using default pool /PRD_www/test and exiting

May 13 11:49:36 andreas info tmm[9337]: Rule /PRD_www/ProxyPass : VS=/PRD_www/andreas-www, Host=192.168.80.3, URI=/foo/bar/: Using parsed pool systst2-ext (make sure you have OneConnect enabled)

Regards Andréas

  • If I understand some information I found correct, I can't use regex in the datagroup String part. right?