Forum Discussion
Following iRule not working in my setup please correct mistake if found
when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "mfcomb.birlasunlife.com" } { if { ([string tolower [HTTP::uri]] starts_with "/media") or ([string tolower [HTTP::uri]] starts_with "/mediaupload") or ([string tolower [HTTP::uri]] starts_with "/webchat") or ([string tolower [HTTP::uri]] starts_with "/webtrak") } then { pool Talisma_MF_Webchat }else{ pool UAT-VS_pool } }
17 Replies
- Michael_61033
Nimbostratus
Try this:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "mfcomb.birlasunlife.com"}{ switch [string tolower [HTTP::uri]] { "/media*" - "/mediaupload*" - "/webchat*" - "/webtrak*" { pool Talisma_MF_Webchat } default { pool UAT-VS_pool } } } }or alternativly your version/way
when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "mfcomb.birlasunlife.com"}{ if { ([string tolower [HTTP::uri]] starts_with "/media") or ([string tolower [HTTP::uri]] starts_with "/mediaupload") or ([string tolower [HTTP::uri]] starts_with "/webchat") or ([string tolower [HTTP::uri]] starts_with "/webtrak") }{ pool Talisma_MF_Webchat } else { pool UAT-VS_pool } } }- together_183451
Nimbostratus
Thanks Michael I will try it and update you. - StephanManthey
Nacreous
It would be necessary to use the --glob parameter along with switch in case you want to use wildcards (*): switch -glob [string tolower [HTTP::uri]] { }
- shaggy
Nimbostratus
if not already assigned, assign a oneconnect profile to the virtual server(s) using this iRule
- together_183451
Nimbostratus
HI , Can somebody explain me about below irule..
when HTTP_RESPONSE { set myValues [HTTP::cookie names] foreach mycookies $myValues { if { [HTTP::cookie version $mycookies] != 1 } { set ckval [HTTP::cookie value $mycookies] set ckpath [HTTP::cookie path $mycookies] HTTP::cookie remove $mycookies HTTP::cookie insert name $mycookies value $ckval path $ckpath version 1 } HTTP::cookie secure $mycookies enable HTTP::cookie httponly $mycookies enable } }
- StephanManthey
Nacreous
Hi together,
I´ve added some comments to the posted iRule to explain what it does:event fired when server reponse is received on virtual server when HTTP_RESPONSE { build a list containing all cookie names retrieved from server response comment: the variable should better be named myCookieNamesList set myValues [HTTP::cookie names] cycle through all list entries ( per cycle $mycookies will represent one of the seen cookie names foreach mycookies $myValues { rebuild all cookies by version 1 cookie if { [HTTP::cookie version $mycookies] != 1 } { set ckval [HTTP::cookie value $mycookies] set ckpath [HTTP::cookie path $mycookies] HTTP::cookie remove $mycookies HTTP::cookie insert name $mycookies value $ckval path $ckpath version 1 } set "secure" attribute for current cookie to value "enable" HTTP::cookie secure $mycookies enable set "httponly" attribute for current cookie to value "enable" HTTP::cookie httponly $mycookies enable } }Thanks, Stephan
- together_183451
Nimbostratus
Thanks Stephan
- together_183451
Nimbostratus
Hello can somebody help me for below rule
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] equals “abc.xyz.com”}{ if { ([string tolower [HTTP::uri]] starts_with "/media") or ([string tolower [HTTP::uri]] starts_with "/mediaupload") or ([string tolower [HTTP::uri]] starts_with "/webchat") or ([string tolower [HTTP::uri]] starts_with "/webtrak") }{ pool test1} } elseif { [string tolower [HTTP::host]] equals “def.xyz.com” } { pool test2_pool } elseif { [string tolower [HTTP::host]] equals “ghi.xyz.com” } { pool test2_pool } elseif { [string tolower [HTTP::host]] equals “klm.xyz.com" } { pool test3_pool } elseif { [string tolower [HTTP::host]] equals “nop.xyz.com” } { pool test4_pool } elseif { [string tolower [HTTP::host]] equals “qrt.xyz.com” } { pool test5_pool } else { pool UAT_pool } }
- PeteWhite
Employee
what sort of help do you want? Did the above answer not work correctly? - together_183451
Nimbostratus
yes, when i try to apply above rule it giving me error..
- Mariappan_S_156
Nimbostratus
Hi,
Please copy properly.
Mariappan S
- together_183451
Nimbostratus
i applied below rule..
hen HTTP_REQUEST {
if {[string tolower [HTTP::host]] equals "mfcomb.test.com"}{ if { ([string tolower [HTTP::uri]] starts_with "/media") or ([string tolower [HTTP::uri]] starts_with "/mediaupload") or ([string tolower [HTTP::uri]] starts_with "/webchat") or ([string tolower [HTTP::uri]] starts_with "/webtrak") }{ pool Talisma_MF_Webchat } elseif { [string tolower [HTTP::host]] equals "abibluat.test.com" } {pool abibluat_pool } elseif { [string tolower [HTTP::host]] equals "abfluat.test.com" } { pool abfluat_pool } elseif { [string tolower [HTTP::host]] equals "pmsuat.test.com" } { pool PMSUAT } elseif { [string tolower [HTTP::host]] equals "peuat.test.com" } { pool peuat_pool } elseif { [string tolower [HTTP::host]] equals "uat.test.com" } { pool UAT_test } else { pool UAT_pool } }
now i want to if request is comes for any other url then it will redirect towards to defined pool
so i have configured below rule
the uri start with media... web track is working but below that if request is come for any uri then it it not redirecting to defined pool
- StephanManthey
Nacreous
Hi together,
it was probably a missing brace. Here are two versions for your requirement. The second one uses "switch" and is probably faster and easier to read/maintain. Please note the following about "switch": - a "-" is kind of "or" comparision. In case of a match the next following decision will apply, i.e. selection of pool Talisma_MF_Webchat - the "default" condition at the end of the list will match all unmatched validations.when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "mfcomb.test.com" } { if { ([string tolower [HTTP::uri]] starts_with "/media") or ([string tolower [HTTP::uri]] starts_with "/mediaupload") or ([string tolower [HTTP::uri]] starts_with "/webchat") or ([string tolower [HTTP::uri]] starts_with "/webtrak") }{ pool Talisma_MF_Webchat } } elseif { [string tolower [HTTP::host]] equals "abibluat.test.com" } { pool abibluat_pool } elseif { [string tolower [HTTP::host]] equals "abfluat.test.com" } { pool abfluat_pool } elseif { [string tolower [HTTP::host]] equals "pmsuat.test.com" } { pool PMSUAT } elseif { [string tolower [HTTP::host]] equals "peuat.test.com" } { pool peuat_pool } elseif { [string tolower [HTTP::host]] equals "uat.test.com" } { pool UAT_test } else { pool UAT_pool } } when HTTP__REQUEST { switch [string tolower [HTTP::host]] { "mfcomb.test.com" { switch -glob [string tolower [HTTP::uri]] { "/media" - "/mediaupload" - "/webchat" - "/webtrak") { pool Talisma_MF_Webchat } } } "abibluat.test.com" { pool abibluat_pool } "abfluat.test.com" { pool abfluat_pool } "pmsuat.test.com" { pool PMSUAT } "peuat.test.com" { pool peuat_pool } "uat.test.com" { pool UAT_test } default { pool UAT_pool } }Further I would like to ask you for two things, please:
1. Would you please mark a question as answered by tagging the response as solution. This will help to keep track of open questions. 2. Please open a new question in case your question is dealing with another subject. Thanks & enjoy weekend, Stephan
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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