Forum Discussion

Sam_Novak's avatar
Sam_Novak
Icon for Altostratus rankAltostratus
Sep 19, 2016

iRule header removal for cached item reponses

Does anyone know if iRules do not apply to cached responses? I like to strip out X-Powered-By headers from my responses, but I'm seeing that header on the client side of things; I haven't made any changes to my iRule (though it's a large one shared between multiple VSs) which leads me to believe that the HTTP_Request and HTTP_Response rules aren't being applied to cached responses.

 

  • I should've done more research before putting in this ask.

    I found the CACHE_RESPONSE event and I can manipulate it just like the HTTP_RESPONSE event

    when RULE_INIT {
    set static::InfoHeaders { "Server" "X-Powered-By" "X-SharePointHealthScore" "X-AspNet-Version" "X-AspNetMvc-Version" }}
    
    when HTTP_RESPONSE { 
     Remove headers that provide information about the backend
    foreach header $static::InfoHeaders {
        HTTP::header remove $header
    }
    
    when CACHE_RESPONSE { 
     Remove headers that provide information about the backend
    foreach header $static::InfoHeaders {
        CACHE::header remove $header
    }}