Hi Anurag
I have had the exact same problem and posted in
http://www.gossamer-threads.com/lists/apache/users/382031?page=last
You can use ExpiresDefault/ExpiresByType (this adds both an Expires and
Cache-Control: max-age header to simultaneously support HTTP 1.0 and HTTP
1.1) or use LocationMatch. For example, I could distinguish between static
content requests (requests to *.gif) vs dynamic content requests
(requests to *.jsp or *.do for a Struts application) using the
LocationMatch. I couldn't find a way of using LocationMatch to work with the
content-type of the response, which was what I needed for file download
requests. Nor could I find a way of checking whether the header was set,
before setting it. (I'm still asking the question).
In the end, I have set the values using e.g. servlet filters in my
application code.
thanks, Balj.

On Mon, Mar 15, 2010 at 12:50 PM, Anurag Kapur <anuragka...@gmail.com>wrote:

> Hello,
>
> I am looking for some help to set HTTP response headers conditionally. I
> have a setup where HTTPD sits in front of Tomcat and proxies requests to it.
>
> *Problem Statement*
> Set a Cache-Control max-age directive in the HTTP response header through
> HTTPD if it doesn't already exist. In addition if HTTPD after detecting that
> the directive is not already set in the response header, it should set one
> depending on the response mime-type.
>
> Example:
> HTTPD proxies a request to tomcat -> Tomcat processes the request and send
> back the response to HTTPD -> HTTPD checks if Cache-Control max-age
> directive is set in the response header. If present it does no changes to
> the response header and simply forwards the response back to the user.
> However, if the Cache-Control max-age directive is not present it sets one
> depending on the response mime type (say max-age=900 for text/html and
> max-age=1800 for image/gif)
> *
> *
> *System Info*
>  $ apachectl -version
>  Server version: Apache/2.2.9 (Unix)
>   Server built:   Sep 12 2008 16:23:39
>
>   $ uname -a
> SunOS vm-sol10-45 5.10 Generic_127128-11 i86pc i386 i86p
>
> *What I Have Tried*
> I have been trying to work with mod_setenvif module to start but have not
> made any progress and thus seeking your help.
>
> Any inputs would be highly appreciated.
>
> Regards
> Anurag
> *
> *------------------------------------------------------------------
> Anurag Kapur
> Associate - Technology,
> Sapient Corporation.
>
> http://www.linkedin.com/in/anuragkapur
>
> http://www.google.com/profiles/anuragkapur
> ------------------------------------------------------------------
>

Reply via email to