Forum Discussion
Tokyo_Jihen_931
Dec 03, 2010Nimbostratus
iRule for URL persistence
Hello all,
I am a newbie of iRules programming. My system is BIG-IP 9.1.2. I am trying to implement persistence using a string that appear in URL.
For example.
http://test.big-ip.com/install/123456
http://test.big-ip.com/scripts/456788
I want the system when seeing the identifier (e.g. 123456, 456788) in the URL, it will use that identifier to persist my traffic to my nodes.
The identifier is always contains 6 characters and should be after the string "install/" or "scripts/"
Does anyone have similar environment with me? Or can provide me any iRule sample to do this?
Thanks
- nitassEmployeecan you try this?
[root@ve1023:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve1023:Active] config b pool foo list pool foo { members 200.200.200.101:80 {} } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if {[scan [HTTP::uri] {%*[^&]&clientIP=%[^?]} session_id] == 1} { log local0. "\[HTTP::uri\]: [HTTP::uri]" log local0. "session_id: $session_id" persist uie $session_id 1800 } } } [root@ve1023:Active] config b persist show all No Persistence Table Entries were found. [root@ve1023:Active] config curl -I http://172.28.19.79/ HTTP/1.1 200 OK Date: Tue, 10 Jan 2012 04:26:36 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT ETag: "4183e4-3e-9c564780" Accept-Ranges: bytes Content-Length: 62 Set-Cookie: BROWSER=MOZILLA%20INTERNET_EXPLORER%20CHROME; path=/ Content-Type: text/html; charset=UTF-8 [root@ve1023:Active] config b persist show all No Persistence Table Entries were found. [root@ve1023:Active] config curl -I 'http://172.28.19.79/ebv/rbv&clientIP=192.168.1.5?svk' HTTP/1.1 404 Not Found Date: Tue, 10 Jan 2012 04:26:55 GMT Server: Apache/2.2.3 (CentOS) Content-Type: text/html; charset=iso-8859-1 [root@ve1023:Active] config b persist show all PERSISTENT CONNECTIONS | Mode universal Value 192.168.1.5 | virtual 172.28.19.79:80 node 200.200.200.101:80 age 6sec [root@ve1023:Active] config tail /var/log/ltm Jan 9 20:26:42 local/tmm info tmm[26866]: Rule myrule HTTP_REQUEST: [HTTP::uri]: /ebv/rbv&clientIP=192.168.1.5?svk Jan 9 20:26:42 local/tmm info tmm[26866]: Rule myrule HTTP_REQUEST: session_id: 192.168.1.5
- nitassEmployeeplease change "& amp ;" (one word in red color) to &
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