Forum Discussion
help combining two irules
The two irules are from two different vips on the same BigIP.
I've tried to combine but i get erros, I can't get the brackets { in the right place with i write the irule.
I would like the irule to follow the logic as numbered below.
1= for the payment string use pool IIS_ECM.SWBC.com_pool
2= esle /holtcat use focusnet.swbc.co
3=- else check for uri path
"/akcelerant/"
"/idsakcelerant/"
"/idsakcelerantmtg/"
"/lmakcelerant/"
use pool Test-SWBC-Migration2
4= else everyting else use pool IIS_SWBC.com_pool
= irules are below ======================================================
primary irule name IIS_SWBC.comProcessorv3
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]]) equals "www.swbc.com" and
([string tolower [HTTP::uri]] contains "paymentprocessorv3")
([string tolower [HTTP::uri]] contains "paymentprocessorakc")
([string tolower [HTTP::uri]] equals "/paymentprocessorv3/creditcard.asmx")
([string tolower [HTTP::uri]] equals "/paymentprocessorv3/creditcard.asmx?wsdl")
([string tolower [HTTP::uri]] equals "/paymentprocessorv3/ach.asmx")
([string tolower [HTTP::uri]] equals "/paymentprocessorv3/ach.asmx?wsdl")
([string tolower [HTTP::uri]] equals "/paymentprocessorakc/ach.asmx")
([string tolower [HTTP::uri]] equals "/paymentprocessorakc/ach.asmx?wsdl")
([string tolower [HTTP::uri]] equals "/paymentprocessorakc/creditcard.asmx")
([string tolower [HTTP::uri]] equals "/paymentprocessorakc/creditcard.asmx?wsdl") } {
pool IIS_ECM.SWBC.com_pool
}
elseif { [string tolower [HTTP::host]] equals "www.swbc.com" and [string tolower [HTTP::uri]] equals "/holtcat" } {
HTTP::redirect https://focusnet.swbc.com/fnFProvider/fnFProvider.asp? app=HCEnrollmentTool&wanted=BECONFIRM&BenefitYear=2011&BenefitType=N
}
else {
pool IIS_SWBC.com_pool
}
}
=============================================================
second irule name Test-SWBC-URI
when HTTP_REQUEST {
use tolower to make the match case-insensitive
switch -glob [string tolower [HTTP::path]] {
"/akcelerant/"
"/idsakcelerant/"
"/idsakcelerantmtg/"
"/lmakcelerant/"
pool Test-SWBC-Migration2
}
}
}
6 Replies
- What_Lies_Bene1
Cirrostratus
Didn't someone already answer this in another post? Anyway, here's my take;when HTTP_REQUEST { if { ([string tolower [HTTP::host]]) equals "www.swbc.com" } { switch -glob [string tolower [HTTP::path]] { "paymentprocessor*" { pool IIS_ECM.SWBC.com_pool return } "/akcelerant/" - "/idsakcelerant/" - "/idsakcelerantmtg/" - "/lmakcelerant/" { pool Test-SWBC-Migration2 return } "/holtcat" { HTTP::redirect https://focusnet.swbc.com/fnFProvider/fnFProvider.asp? app=HCEnrollmentTool&wanted=BECONFIRM&BenefitYear=2011&BenefitType=N return } else { pool IIS_SWBC.com_pool } } } } - What_Lies_Bene1
Cirrostratus
Missed some wildcards, now added;when HTTP_REQUEST { if { ([string tolower [HTTP::host]]) equals "www.swbc.com" } { switch -glob [string tolower [HTTP::path]] { "paymentprocessor*" { pool IIS_ECM.SWBC.com_pool return } "/akcelerant/*" - "/idsakcelerant/*" - "/idsakcelerantmtg/*" - "/lmakcelerant/*" { pool Test-SWBC-Migration2 return } "/holtcat*" { HTTP::redirect https://focusnet.swbc.com/fnFProvider/fnFProvider.asp? app=HCEnrollmentTool&wanted=BECONFIRM&BenefitYear=2011&BenefitType=N return } else { pool IIS_SWBC.com_pool } } } } - Gill_32697
Nimbostratus
yes, but i didnt state my question clearly, so I thought I would repost. I trying the last example you sent but im getting error blow.
01070151:3: Rule [/Common/SWBC-Merged-irule] error:
line 16: [wrong args] [HTTP::redirect https://focusnet.swbc.com/fnFProvider/fnFProvider.asp? app=HCEnrollmentTool&]
line 16: [undefined procedure: wanted=BECONFIRM&] [wanted=BECONFIRM&]
line 16: [undefined procedure: BenefitYear=2011&] [BenefitYear=2011&]
line 16: [undefined procedure: BenefitType=N] [BenefitType=N] - What_Lies_Bene1
Cirrostratus
Understood. Can you please enclose the redirect URL in speech marks: "..." - Gill_32697
Nimbostratus
Thank you Steve, i was able to add the script to the irule. We can start testing now. Im not good at scripting irules so im sure i'll need help to edit irule as we test, but at least we have base to start testing. BTY, is there a doc you recommend that would help me start to learn the irules scripting...Thank you for the help. - What_Lies_Bene1
Cirrostratus
Great, you're welcome. I'm not aware of any specific documents but the iRules 101 series on DC is pretty amazing.
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