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