regexp
2 TopicsProxyPass 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éas398Views0likes1Commentregex irule without payload change
Hi, I try to write an irule which logs client ip with posted username on a json request. I can able to gather full post payload but that includes the password and other info so i generate a regex to only write the client ip and username on the log file but when i use regex vserver starts to reset connection. If i avoid regex and collect ip and full json payload no problem. Can anyone help me regarding this example? Appriciated. when HTTP_REQUEST { if { [HTTP::method] eq "POST" and [HTTP::uri] starts_with "/api/test/login" } { set log_msg "" set client_ip [IP::remote_addr] set paypay [HTTP::payload] set pay [HTTP::payload] append log_msg "client_ip=$client_ip " append log_msg [regexp {(?<=\{"username":").*?(?=",)} $paypay] append log_msg "$paypay" log local0. $payload log 1.1.1.1 local0. $log_msg } }401Views0likes1Comment