Hi,
I have written an Irule as below when HTTP_REQUEST { if{([HTTP::host] contains"eulyncweb01.csmglobal.net ")and([HTTP::uri] contains"/RequestHandler/Files/UCPhone")
node 10.96.96.16 80
} else{ HTTP::redirect https://[HTTP::host][HTTP::uri] } }
However upon execution it is throwing below error Please if someone can help with as to what is wrong
n 25 10:57:19 nladmll003 err tmm1[11990]: 01220001:3: TCL error: /Common/Lync-test - invalid command name “if{(eulyncweb01.csmglobal.net ” while exe cuting “if{([HTTP::host] equals"eulyncweb01.csmglobal.net ”)and([HTTP::uri] contains"/RequestHandler/Files/UCPhone"} { node 10.96.96.16 80 } else{ "
TechT
June 25, 2015, 10:07am
2
Hi Mohanish , try the below :
Code
when HTTP_REQUEST { if { ([HTTP::host] contains “eulyncweb01.csmglobal.net ”) and ([HTTP::uri] contains “/RequestHandler/Files/UCPhone”) } { node 10.96.96.16 } else { HTTP::redirect “https://[HTTP::host][HTTP::uri]” } }
TechT
June 25, 2015, 10:14am
3
Hi Mohanish , try the below :
when HTTP_REQUEST {
if { ([HTTP::host] contains "eulyncweb01.csmglobal.net") and ([HTTP::uri] contains "/RequestHandler/Files/UCPhone") } {
node 10.96.96.16 }
else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
}
Hi Maneesh,
Thanks I will try this out and let you know. However please if you can let me know what is wrong with my above code is it the spacings that are going wrong
Couple of close brace, space were missing and you added port 80 with the node.
since 11.4, the best way to do what you want is to create a LTM policy. it is easier to configure in GUI and best to see rules.
The following lines allow to create policy in TMSH and create expected rules:
create ltm policy /Common/eulyncweb01-HTTP requires add { http } strategy first-match controls add { forwarding }
modify ltm policy /Common/eulyncweb01-HTTP rules add {UCPhone { actions add { 0 { forward select node 10.96.96.16 } } conditions add { 1 { http-host host values { eulyncweb01.csmglobal.net } } 2 { http-uri path contains values { "/RequestHandler/Files/UCPhone" } } } ordinal 1 }}
modify ltm policy /Common/eulyncweb01-HTTP rules add {redirect { actions add { 0 { http-reply redirect location https://[HTTP:host][HTTP::uri] } } ordinal 2 }}
and the configuration is: (you can load it with tmsh load sys merge from-terminal
ltm policy eulyncweb01-HTTP {
controls { forwarding }
requires { http }
rules {
UCPhone {
actions {
0 {
forward
select
node 10.96.96.16
}
}
conditions {
1 {
http-host
host
values { eulyncweb01.csmglobal.net }
}
2 {
http-uri
path
contains
values { /RequestHandler/Files/UCPhone }
}
}
ordinal 1
}
redirect {
actions {
0 {
http-reply
redirect
location https://[HTTP:host][HTTP::uri]
}
}
ordinal 2
}
}
strategy first-match
}