Forum Discussion

InnO's avatar
InnO
Icon for Nimbostratus rankNimbostratus
Sep 16, 2014

Question about If-Modified-Since HTTP header

Hi all,

I am running in something I cannot explain at this time, so any help would be greatly appreciated. Seems I do not understand the HTTP headers If-Modified-Since and If-None-Match 🙂

I initially wanted to get the values of these headers, but since that was void, I just decided to check if they simply exist and log the result. Seems they don't. But when checking the http capture whether in tcpdump or Fiddler, I can see those 2 headers are present...

What am I missing about the behavior of these headers ?

Here is my very basic iRule

when HTTP_REQUEST {
        if {[HTTP::header exists "If-Modified-Since"] } { 
            set ims 100 
        set inm 100
    }
    else { 
        set ims 0
        set inm 0
    }
    log -noname local0. "My IMS est : $ims and my INM : $inm"
}

and the data capture : Thanks !

6 Replies

  • The If-Modified-Since and If-None-Match headers are used for cache control. Did you want to do something particular with these two headers?

    So if you do this, what do you see?

    when HTTP_REQUEST {
        if { [HTTP::header exists If-Modified-Since] } {
            log local0. "If-Modified-Since exists: [HTTP::header If-Modified-Since]"
        }
        if { [HTTP::header exists If-None-Match] } {
            log local0. "If-None-Match exists: [HTTP::header If-None-Match]"
        }
    }
    
  • Sorry to resond with a question but can you tell me what the '-noname' option on your log command does please?
  • InnO's avatar
    InnO
    Icon for Nimbostratus rankNimbostratus

    Thx Kevin. Running this iRule, nothing happens, it seems headers just do not exist... I can get and log any other header, but these 2 ones are just escaped...

     

    I do not really want to do something with these headers. The thing is I just want to understand why I have that happening...

     

  • Also, try this:

    when HTTP_REQUEST {
        foreach x [HTTP::header names] {
            log local0. "request header ($x): [HTTP::header $x]"
        }
    }