Forum Discussion

Mike_62629's avatar
Mike_62629
Icon for Nimbostratus rankNimbostratus
May 19, 2008

Are http headers case sensitive?

I know the content-matching will be case sensitive, but when doing a header lookup, is the header name itself case sensitive?

Meaning, will this:

[HTTP::header "clientid"]

Return the same data, regardless of whether the http header is clientid, clientId, clientID, Clientid, ClientId, or ClientID?

Thanks for any input.

5 Replies

  • It's case insensitive. Here's a quick test:

     
     when HTTP_REQUEST { 
         Insert a test header with a name of TEST and a value of "some_value" 
        HTTP::header insert TEST "some_value" 
      
         Log the value of the header with variations on the case 
        if {[HTTP::header exists test]}{ log local0. "test: [HTTP::header value test]"} 
        if {[HTTP::header exists TEST]}{ log local0. "TEST: [HTTP::header value TEST]"} 
        if {[HTTP::header exists TeSt]}{ log local0. "TeSt: [HTTP::header value TeSt]"} 
     } 
     

    Here is the log output:

    : test: some_value

    : TEST: some_value

    : TeSt: some_value

    Aaron
  • You could also send custom headers (and cookies) from the BIG-IP itself using curl. The BIG-IP can answer requests from the CLI to a VIP on 9.4.0 and above.

     

     

    curl -k https://VIP/test/ -H "Host: somehost" -H "some_header: some_header_value" -H "Cookie: some_cookie=some_value"

     

     

    Aaron
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Nice example Aaron! Maybe I need to add a page to the Wiki that lists "Cool iRule Tricks!" where we list things like this curl command that are helpful when dealing with iRules, but aren't direct iRules code/commands.

     

     

    Dig it....

     

     

    Colin
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Since the iRules inherently depend on the profiles applied to VIPs to determine how they'll behave and what commands are valid, there's no way to test them without applying them to a system.

     

     

    Colin