Re: Interaction of mod_headers and mod_expires

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

 



On Wed, May 22, 2013 at 7:21 AM, Michael Weiser <M.Weiser@xxxxxxxxxxxxxxxxxxxx> wrote:
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.

Is mod_expires supposed to work in conjunction with mod_headers?

You need to add Vary: User-Agent to tell the proxy that the server returns different content depending on the user agent.
You could add something like this:
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent

I will not comment on whether this is the "right" way to do this. Some might suggest using _javascript_ browser feature detection instead.

- Y

[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