Interaction of mod_headers and mod_expires

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I've inherited a web server setup that has mod_expires configured like
this:

ExpiresActive on                                                                                                                          
ExpiresDefault "access plus 24 hours"                                                                                                     

Also, there is a redirect to a special page if a browser is not
supported by the site:

RewriteEngine on                                                                                                                          
RewriteCond %{REQUEST_URI} !/browser_not_supported/                                                                                       
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4\.0\s*\(compatible;\s*MSIE\s*(1|2|3|4|5|6|7|8)\.(?!.*IEMobile)                                   
RewriteRule (.*) /browser_not_supported/index.html [R=302,L]                                               

Both work fine by themselves. Unfortunately, the 302 redirect generated
by the rewrite rule also gets Cache-Control and Expires headers like this:

< Cache-Control: max-age=86400
< Expires: Thu, 23 May 2013 11:03:00 GMT

This makes some proxies cache the redirect. When the user then starts
her supported browser and connects to the site again, the proxy will
serve her the same redirect again and thus redirect the supported
browser to the browser-not-supported page as well.

First off: Is this the proper way to implement such a
browser-not-supported page or is there a better way to do it?

I've boilt it down to the following testcase and tried to override the
headers using mod_headers like this:

RewriteEngine On
RewriteRule /blah /notsup [L,R=302,E=notsup:1]
Header always set Cache-Control "neverevercache" env=notsup
Header always set Expires "now" env=notsup
ExpiresActive On
ExpiresDefault "access plus 1 days"

Unfortunately this causes two headers to be present in the response:

< Cache-Control: neverevercache
< Expires: now
< Cache-Control: max-age=86400
< Expires: Thu, 23 May 2013 11:03:00 GMT

Is this even valid HTTP or is this a bug?
Is mod_expires supposed to work in conjunction with mod_headers?

I've verified this behaviour with apache-2.2 and 2.4.

Thanks,
-- 
Michael Weiser                science + computing ag
Senior Systems Engineer       Geschaeftsstelle Duesseldorf
                              Martinstrasse 47-55, Haus A
phone: +49 211 302 708 32     D-40223 Duesseldorf
fax:   +49 211 302 708 50     www.science-computing.de
-- 
Vorstandsvorsitzender/Chairman of the board of management:
Gerd-Lothar Leonhart
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Michael Heinrichs, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Philippe Miltin
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx






[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux