Forum Discussion

prdg-jason_1930's avatar
prdg-jason_1930
Icon for Nimbostratus rankNimbostratus
May 20, 2015

Insert header

Hi everyone,

 

I am trying to insert an http header if the http query contains a certain word. Here is what I have:

 

when HTTP_REQUEST { if {[string tolower [HTTP::query]] contains "admin"} { log local0. "Header Inserted" HTTP::header insert SecureAdmin true } }

 

I have verified by the log that the query string is matching (and thus going into the if statement). However, the header doesn't seem to get inserted. I'm using LiveHttpHeaders to view and I'm not seeing the "SecureAdmin" header.

 

Can anyone help me out with what I'm missing?

 

Thanks!!!

 

1 Reply

  • Disregard this. It works. LiveHTTPHeaders must just not work correctly. I added to the IRule:

     

    when HTTP_REQUEST { if {[string tolower [HTTP::query]] contains "admin"} { log local0. "Header Inserted" HTTP::header insert SecureAdmin true foreach aHeader [HTTP::header names] { log local0. "$aHeader: [HTTP::header value $aHeader]" } }

     

    and the log shows the header.