Forum Discussion

DaleLeBlanc_140's avatar
DaleLeBlanc_140
Icon for Nimbostratus rankNimbostratus
Jan 26, 2015

Create iRule from TMOS

I am trying to create an iRule similar to this from TMOS.

 

when HTTP_REQUEST { HTTP::header replace "Host" "4.2.2.2" }

 

When I enter the following syntax, I get some type of editor. How can I simply create the iRule in one command?

 

create rule my_rule when HTTP_REQUEST HTTP::header replace "Host" "4.2.2.2"

 

2 Replies

  • I found that this creates the iRule, but only from CLI of the LTM (this works):

     

    tmsh create ltm rule my_rule when HTTP_REQUEST { HTTP::header replace \"Host\" \"4.2.2.2\" }

     

    However, the same command does not work from within TMOS (ltm prompt):

     

    tmsh ltm create rule my_rule when HTTP_REQUEST { HTTP::header replace \"Host\" \"4.2.2.2\" }

     

    Last line causes Syntax Error: Unexpected {

     

  • Are you refering to the TMSH prompt from within the CLI? If so, you may want to try like this:

     create ltm rule my_rule "when HTTP_REQUEST { HTTP::header replace \"Host\" \"4.2.2.2\" }"
    

    It will probably put you into vi editor to save the file.