Forum Discussion

ERLomboy_27803's avatar
ERLomboy_27803
Icon for Nimbostratus rankNimbostratus
May 09, 2017

Help with iRule syntax

Hi members,

 

Need help with iRule programming. can someone help provide assistance to have this script work?

 

when HTTP_REQUEST { if { not ([class match [string [IP::local_addr] ]] contains ApiGWHosts]) }{ foreach header {idm_header} { HTTP::header remove $header } } }

 

It's giving out an error. PARSE syntax 93 {syntax error in expression " not ([class match [string [IP::local_addr] ]] contains ApiG...": variable references require preceding $}][{ not ([class match [string [IP::local_addr] ]] contains ApiGWHosts])

 

Thanks!! and appreciate the help!

 

2 Replies

  • Hi,

    you can try this version:

    when HTTP_REQUEST {
        if { not ([class match [string [IP::local_addr] ] contains ApiGWHosts]) } {
            foreach header {idm_header} { HTTP::header remove $header }
        }
    }
    

    there was 1 closing bracket I removed and a space I added between

    }
    and
    {
    at the end of if condition

  • when HTTP_REQUEST {
        if { not ([class match [IP::local_addr] contains ApiGWHosts]) } {
            foreach header {idm_header} { HTTP::header remove $header }
        }
    }