2008/9/12 André Warnier <aw@xxxxxxxxxx>: > dave selby wrote: >> >> 2008/9/12 André Warnier <aw@xxxxxxxxxx>: >>> >>> Manik Taneja wrote: >>>> >>>> Nope, there is no way you can prevent the client from sending you an IMS >>>> request. >>> >>> The above is correct, but if I understand the OP question correctly, the >>> basic issue is to make sure that the client does not re-use a cached >>> page, >>> but always retrieves the latest page from the server. >> >> Sorry, its me not explaining myself very clearly. Its the opposite. >> > Yes, I apologise, I saw that later. > > First, I don't know if the behaviour that you describe for Apache (to > consider that the file is modified if its directry is) is normal or not. > Maybe someone else can comment on that. Yep I need to pin this down. I use an alias to access the images dbase and it appears to be the 'images_dbase' dir modified time that is tripping apache into thinking the image file has been modified. Alias /images_dbase/ /home/dave/kmotion2/images_dbase/ Can anyone say definitively how apache knows if a file has been modified, I know its not just the file modification time, does it check every dir's modification time in the entire path ? > But assuming for the time being that this is really what happens, then a > possible solution might be along these lines : > > You can still not stop the browser from sending its request with an > "If-modified-since" header. But maybe on the server you can just pre-empt > Apache's own check, and immediately return a "not modified" to the browser. OK > In a <Location> or <Directory> section (depending on what exactly you want > to submit to this behaviour), you would need to > - have something that examines the incoming request headers, and detect if > there is an "If-modified-since" header (and maybe, to be sure, if the > request is for one of the image files). > - if it is so, "force" a response "not modified" to the browser, so that it > will use its cached version. > > I think mod_rewrite should allow you to do that. Interesting ... > But you must be somewhat careful, so that you do indeed not end up blindly > sending "not modified" headers for everything on your server, just for > specifically these files that you don't want always resent. > > Also, there may be more to send back than just a "304 Not Modified" status > line. > > I am interested to work this out with you, because I just started myself > this very morning to look at the mod_rewrite module, and I'm curious if this > is something it can do. > The mod_rewrite capabilities (and docs) are somewhat daunting though, so if > a specialist could jump it to offer help, it would not be refused. I have previously looked at mod_rewrite myself, it game me the impression of powerful but as you say daunting :) As it ended up I did not need it. > > Here is an example of a request and a response, which I just captured with > the Firefox add-on "Live Http Headers" : > > GET /docs/2.2/images/mod_rewrite_fig2.gif HTTP/1.1 > Host: httpd.apache.org > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.15) > Gecko/20080623 Firefox/2.0.0.15 > Accept: image/png,*/*;q=0.5 > Accept-Language: en-gb,en;q=0.5 > Accept-Encoding: gzip,deflate > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > Keep-Alive: 300 > Connection: keep-alive > Referer: http://httpd.apache.org/docs/2.2/rewrite/rewrite_intro.html > If-Modified-Since: Tue, 20 Sep 2005 11:00:07 GMT > If-None-Match: "3c12a-9f9-40131f6791bc0" > Cache-Control: max-age=0 > > HTTP/1.x 304 Not Modified > Date: Fri, 12 Sep 2008 09:33:28 GMT > Server: Apache/2.2.9 (Unix) > Connection: Keep-Alive > Keep-Alive: timeout=5, max=96 > Etag: "3c12a-9f9-40131f6791bc0" > > > From the look of it, it would seem that none of the lines following the > initial status line are really essential. I agree ... though you are more fluent in Apache / HTTP than me ... I see where you are going with this and it might just work although I am now thinking of a more daemon oriented approach so restructure 'images_dbase' to avoid this issue. The problem is, and I found this when I released kmotion v1, if you do __ANYTHING__ a bit unusual or non standard the application ends up breaking on this server version, on this hardware etc etc so I am trying to keep away from unusual. > The only one I'm not sure of, is the "Etag", which seems to correspond to > the request header "If-none-match". > > Let's say my first try would be like > > RewriteEngine on > RewriteLog /var/log/apache2/mysite/rewrite.log > RewriteLogLevel 9 (so we see what's happening) > > <Location /thelocation> > RewriteRule [^/]+\.(gif|jpeg|png)$ - [L] > ... > </Location> > > And now I'm stuck, because I don't know yet how to tell mod_rewrite to send > a response with some headers, but no body .. > > > --------------------------------------------------------------------- > The official User-To-User support forum of the Apache HTTP Server Project. > See <URL:http://httpd.apache.org/userslist.html> for more info. > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx > " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx > > -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx