Forum Discussion

JG_249184's avatar
JG_249184
Icon for Altocumulus rankAltocumulus
May 21, 2017

Ignore case sensitive in the HTTP host header request

Hello -

 

I am trying to replace the 3 bottom if statements with 1 line that ignores case sensitive characters in the HTTP host header request. The application guys have different configuration files sending a mix of either upper or lower cases and some all together.

 

when HTTP_REQUEST { if { [HTTP::header "Host"] equals "myapplication.mydomain.com" } {

 

} elseif { [HTTP::header "Host"] equals "MyApplication.mydomain.com" } { } elseif { [HTTP::header "Host"] equals "MYAPPLICATION.mydomain.com" } {

 

} else { reject

 

  • Hi,

    you can use this irule:

    when HTTP_REQUEST { 
        if { !([string tolower [HTTP::host]] equals "myapplication.mydomain.com") } {
            reject
        }
    }