Forum Discussion
MrGlass_204919
Sep 05, 2017Nimbostratus
Hi Stan,
Thanks for your answer. I am a total beginner on irules so could you please check if this is correct?
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/business/portal.*html" {
pool EXP_business.x.x-static-pool_HTTP
persist none
SSL::disable serverside
}
switch { [HTTP::host] equals "business.x.x"} {
{[HTTP::uri] contains "business/portal/"} {
HTTP::header replace "Host" "x-y-exp.x.x"
log local0. "Rewrite business portal"
"/business/portal.*" {
pool EXP_business.x.x-https_pool
log local0. "Default"
}
}
}
- Stanislas_Piro2Sep 07, 2017Cumulonimbus
Hi,
your irule format is wrong. you merge if / then / else and switch commands, which worth work.
switch format is :
switch [options like --glob, ...] string { pattern1 { actions for pattern1 } pattern2 { actions for pattern2 } pattern3 - pattern4 { actions for pattern3 and pattern4 } default { actions if no previous pattern matches } }
patterns are string (no condition) which can support wildcard if
option was set-glob
if / then / else format is:
if {condition1} { actions for condition1 } elseif {condition2} { actions for ondition2 } else { actions if no previous condition matches }
condition can be
[HTTP::uri] equals "/portal/"