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!

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 }
    }
}