Forum Discussion

Robert_77728's avatar
Robert_77728
Icon for Nimbostratus rankNimbostratus
Sep 25, 2012

Problem with HTTP_RESPONSE for a certain host or pool

 

I'm trying to filter the HTTP_RESPONSE to only work with a certain host or pool. I'm getting an error saying "[HTTP::host] cannot be used with HTTP_RESPONSE". My question is how can I filter this iRule to only work with a certain host or pool? Thank you for your time... I'm a newbie!

 

 

version 10.2.2

 

 

when HTTP_RESPONSE {

 

if {[HTTP::host] contains "test.nowhere.com"}{

 

if {[matchclass [HTTP::header Content-Type] equals $::pdf_reports]}{

 

HTTP::header replace Cache-Control "max-age = 60"

 

}

 

}

 

}

 

6 Replies

  • Access HTTP::host in the HTTP_REQUEST event and save it to a variable for use in the HTTP_RESPONSE event.

     

     

    Search the wiki for samples using HTTP_RESPONSE.
  • I did and HTTP::host is listed but I'm getting the error saying it's not allowed.
  • This one should do the trick: https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/2161531/showtab/groupforums/Default.aspx. Looks pretty simple.
  • That worked great! Thanks "What Lies Beneath"!!!

     

    I'm not sure why my search didn't find that!
  • You're welcome. Btw, how did you mark the topic as solved? I need to do that with a few questions of my own.