Forum Discussion

Rajeev_Kanzinga's avatar
Rajeev_Kanzinga
Icon for Nimbostratus rankNimbostratus
Feb 22, 2016

irule creation with tmsh using switch option

Hi can any one tell me what wrong in this irule creation?

 

create ltm rule /Common/myrule when HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] {"xyz-external-fin.test.com" { pool xyz-external-fin } "xyz-external-prj.test.com" { pool xyz-external-prj }default { discard } } }

 

it gives error "Syntax Error: Unexpected {"

 

Regards, Rajeev

 

2 Replies

  • I'm not sure you can put in a 1 liner rule like this and may need to drop to editor mode and paste in. You could also try putting this in via bash, note you need a space before default in your rule.

    [root@f51:Active:Standalone] config  tmsh create ltm rule /Common/myrule when HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] {"xyz-external-fin.test.com" { pool xyz-external-fin } "xyz-external-prj.test.com" { pool xyz-external-prj } default { discard } } }
    
    [root@f51:Active:Standalone] config  tmsh list ltm rule myrule
    ltm rule myrule {
        when HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] {xyz-external-fin.test.com { pool xyz-external-fin } xyz-external-prj.test.com { pool xyz-external-prj } default { discard } } }
    }
    
  • mo_99289's avatar
    mo_99289
    Historic F5 Account

    BIGIP doesn't support create irule by this way now. we already had bug to address this.

     

    Users can create an iRule through an editor, from-terminal, or from a file.