Forum Discussion
Irule not working
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{ "
5 Replies
- TechT
Nimbostratus
Hi Mohanish , try the below :
Codewhen 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
Nimbostratus
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]" } } - Mohanish_169493
Nimbostratus
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
- TechT_163800
Nimbostratus
Couple of close brace, space were missing and you added port 80 with the node.
- Stanislas_Piro2
Cumulonimbus
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 }
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