Forum Discussion

Andrew_L's avatar
Icon for Nimbostratus rankNimbostratus
Jun 28, 2021

Issue with implementing an irule through a script.

I'm currently trying to implement an iRule using tmsh from within a bash script, but this results in an error that I've not been able to find information on.


The scripted command:


tmsh create ltm rule /Common/ \

  when HTTP_REQUEST priority 200 { \

    set Redirect \"404\"\

    if { [info exists \"Redirect\"] } {\

      HTTP::respond 301 Location $Redirect \

      HTTP::respond replace Cache-Control no-cache ;\

      event disable all\




The error:


01070151:3: Rule [/Common/] error: /Common/ error: [wrong # args][set Redirect "404" if { [info exists "Redirect"] } { HTTP::respond replace Cache-Control no-cache event disable all } ]


As far as I can tell there's no missing argument or extra argument to be found.

I've checked for whitespaces that aren't plain spaces (and retyped it manually just to be sure there isn't an artifact from cutting and pasting).

I've tried entering it from the command line within tmsh itself.

The only way that it seems to work is if I enter it from the webGUI (Local Traffic >> iRules >> iRule list >> AppName_redir301_irule), after which no error message results at all. (note: the trailing backslashes are removed)

Unfortunately entering it from the command line isn't an option (this will go on a remote system that I don't have access to, via an operator who solely runs scripts).

Can someone show me where I've gone wrong?






1 Reply