Forum Discussion
Irule Help
Hello, I am trying to configure the iRule below but keep running into the error below. Any one know where the braces need to go?
error: line 1: [braces are required around the expression]
when HTTP_REQUEST { if { [HTTP::host] contains “xyz.com” and [HTTP::path] eq “/assets/app/img/logo.png″ } { HTTP::redirect "http://[HTTP::host]/assets/app/img/new-logo.png" } elseif { [HTTP::host] contains “xyz.com” and [HTTP::path] eq “/assets/app/css/style.css″ }{ HTTP::redirect “http://[HTTP::host]/assets/app/css/new-style.css” } }
when HTTP_REQUEST { if { ([HTTP::host] contains "xyz.com") and ([HTTP::path] eq "/assets/app/img/logo.png") } { HTTP::redirect "http://[HTTP::host]/assets/app/img/new-logo.png" } elseif { ([HTTP::host] contains "xyz.com") and ([HTTP::path] eq "/assets/app/css/style.css") }{ HTTP::redirect "http://[HTTP::host]/assets/app/css/new-style.css" } }
- Kevin_Davies_40Nacreous
when HTTP_REQUEST { if { ([HTTP::host] contains "xyz.com") and ([HTTP::path] eq "/assets/app/img/logo.png") } { HTTP::redirect "http://[HTTP::host]/assets/app/img/new-logo.png" } elseif { ([HTTP::host] contains "xyz.com") and ([HTTP::path] eq "/assets/app/css/style.css") }{ HTTP::redirect "http://[HTTP::host]/assets/app/css/new-style.css" } }
- Chris_G_01_1415Nimbostratus
I copied and pasted your answer but I still got the same error.
- Kevin_Davies_40NacreousYes I just updated the quotes. There were some still wrong from the original post. Try to copy/paste now.
- Chris_G_01_1415Nimbostratus
Awesome that worked. Was the issue with just the quotes?
- Kevin_Davies_40Nacreous
No, you need () around the conditions in the if statements. When you use "and" is it expecting to compare logical arguments. If you don't have the () it tries to compare '"xyz.com" and [HTTP::path] which will fail as they are not true or false arguments.
If the posted solution solves your problem, ensure you mark the post(s) that resolved your issue. It gives the tireless volunteers who help you and me, a little recognition for their efforts :-)
- Chris_G_01_1415Nimbostratus
Ahhh I see. Well thank you very much for your the explanation and help.
- Kevin_Davies_40NacreousWas referring to the posting system on the devcentral website. Click the tick to the left of the post that resolved the issue :-)
- Chris_G_01_1415Nimbostratus
I thought I did that. Apologies
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