RE: mod_rewrite And Browser Caching

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

 



> On 18 August 2012 15:55, Drew Tomlinson <drew@xxxxxxxxxxxxxxxxxx> wrote:
>> So now I'm trying to understand how browsers cache information and what it
>> takes to get them to forget that information.

Make your pages adhere to the RFC spec for caching.  Use cache-control headers such as "no-cache" or "private" to ensure cache is revalidated against the source.  You haven't provided any details on the type of page you're calling from "whatever" but likely the resource is considered cacheable and the browser doesn't need to revalidate against httpd.

There is a pretty good overview of browser caching here:  http://www.mnot.net/cache_docs/

James Rapp


-----Original Message-----
From: Ben Johnson [mailto:ben@xxxxxxxxxxxxxxxx] 
Sent: Saturday, August 18, 2012 9:51 AM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  mod_rewrite And Browser Caching



On 8/18/2012 11:30 AM, sebb wrote:
> On 18 August 2012 15:55, Drew Tomlinson <drew@xxxxxxxxxxxxxxxxxx> wrote:
>> I've been working at this for days and couldn't figure out why a mod_rewrite
>> rule wasn't working.  My situation was that I wanted to redirect this:
>>
>> http://domain.com/unique_directory/whatever
>>
>> to
>>
>> https://domain.com/unique_directory/whatever
>>
>> While not redirecting http://domain.com/other_directories/whatever
>>
>> After beating my head for a few days and realizing first attempts were
>> creating a rewrite loop, I finally came up with this syntax:
>>
>> RewriteEngine On
>> RewriteCond %{HTTPS} off
>> RewriteCond %{REQUEST_URI} \/unique_directory\/ [NC]
>> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
>>
>> Yet on the PC I had been using for testing, the redirects were still failing
>> using both Firefox 14 and Internet Explorer 9.  I had many tabs open in
>> Firefox so I never closed and reopened it but I did close and reopen IE9.
>> Attempts to load pages still timed out just like when I had the rewrite loop
>> in place.
>>
>> Also, I had enabled the RewriteLog for debugging with RewriteLogLevel 9.  I
>> thought it odd that I would not see requests from my IP address hitting the
>> rewrite log.
>>
>> Finally in desperation, I went to another PC and tested with the same
>> browsers.  Redirection worked just as I expected it to and I could see those
>> in the rewrite log.
>>
> 
> An alternative would be to use a client that does not cache, for
> example curl or wget.
> 
>> So now I'm trying to understand how browsers cache information and what it
>> takes to get them to forget that information.
>>
>> Thanks in advance.
>>
>> Cheers,
>>
>> Drew

Where Firefox is concerned, there's a plug-in that enables one to toggle
the browser cache with a convenient toolbar icon:

http://pau.santesmasses.net/cachetoggle/

This little tool is indispensable to any serious developer.

(I am in no way affiliated with this plug-in; I'm just a satisfied user.)

-Ben


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


---------------------------------------------------------------------
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