Rewriting of HTTP Headers

Hi everybody.

I’m new in this community and it could be possible that this issue has been already treated.

I’m having a problem with my WA 4500. If I access directly to my origin servers, I get the following HTTP-HEADER

Expires: Thu, 22 May 2008 21:55:53 GMT

Cache-Control: public, max-age=3600

But when I pass thru my WAs the header changes into:

Expires: Thu, 22 May 2008 21:55:53 GMT

Cache-Control: private, max-age=3600

As the support guys told me, this is a bug of the product that seems to REWRITE HTTP-HEADERS.

In order to solve that situation I’ve tried with some iRules but without success

The idea is to rewrite the headers when I detect that the http-header directive is equal to “private, max-age=3600” into “public, max-age=3600”

But I need also to restrict this operation to those files that end with “.html”

I’ve tried with this iRule, but it is incorrect because [HTTP::uri] is not a clause of the HTTP_RESPONSE method :

when HTTP_RESPONSE {

if {([HTTP::header Cache-Control] eq “private, max-age=3600”) and ([HTTP::uri] ends_with “.html”)} {

HTTP::header replace Cache-Control “public, max-age=3600”

}

}

Any suggestion?

Regards

Federico

Hi Federico,

You can save the URI on the request and then reference it in HTTP_RESPONSE:

when HTTP_REQUEST { 
  
     Save the URI 
    set uri [HTTP::uri] 
 } 
 when HTTP_RESPONSE { 
  
    if {([HTTP::header Cache-Control] eq "private, max-age=3600") and ($uri ends_with “.html”)} { 
  
       HTTP::header replace Cache-Control "public, max-age=3600" 
    } 
 }

Aaron