You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bello Martinez Sergio <se...@televes.es> on 2007/07/20 14:15:08 UTC

[users@httpd] Want to avoid 304 error

Hi all,
I've configured Apache so that some elements (i.e. .js, .gif, .jpeg, 
etc) are stored in browser's cache during a time. When I access to a 
page contaning any of those elements, the browser doesn´t make a request 
to the server, it get the content from cache instead. Until this moment, 
all is ok.
The problem arises when the time I chose for element's caching finishes. 
After this moment, each time the browser need one of those cached 
elements, It makes a http request to the server and the response 
includes a 304 error (I know it´s not an error, only a 'not modified' 
message). The problem is that when a page contains many of these 
elements (.js, .gif, etc), performance get worse (pairs request-reponse 
304 take time), and there isn't a way to tell the browser to use cache's 
information again, unless you modify files at server side.
So I want to know or if there is a way to configure Apache so that 
browsers renew cache's elements expiry date when they receive a 304 
error, or to configure Apache to not to answer with error 304, but to 
reply with the corresponding file, even though this file's been not 
modified.

Thanks a lot,

Besbello

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 20.07.07 14:15, Bello Martinez Sergio wrote:
> I've configured Apache so that some elements (i.e. .js, .gif, .jpeg, 
> etc) are stored in browser's cache during a time. When I access to a 
> page contaning any of those elements, the browser doesn´t make a request 
> to the server, it get the content from cache instead. Until this moment, 
> all is ok.
> The problem arises when the time I chose for element's caching finishes. 
> After this moment, each time the browser need one of those cached 
> elements, It makes a http request to the server and the response 
> includes a 304 error (I know it´s not an error, only a 'not modified' 
> message). The problem is that when a page contains many of these 
> elements (.js, .gif, etc), performance get worse (pairs request-reponse 
> 304 take time),

the request-response are always there, unless you send Expires: header for
objects. And if uses forces refresh, they will be re-fetched anyway.
> and there isn't a way to tell the browser to use cache's 
> information again, unless you modify files at server side.
> So I want to know or if there is a way to configure Apache so that 
> browsers renew cache's elements expiry date when they receive a 304 
> error, or to configure Apache to not to answer with error 304, but to 
> reply with the corresponding file, even though this file's been not 
> modified.

Why do you think that if browser will always fetch the content, it will be
faster? The whole meaning of 304 status is that the data don't have to be
fetched, so the loading will be faster. In case of 200 status, all content
will be sent from server to browser again, and THIS is the case where it
might get really slow.

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I don't have lysdexia. The Dog wouldn't allow that.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Joshua Slive <jo...@slive.ca>.
On 7/23/07, Bello Martinez Sergio <se...@televes.es> wrote:
>
>
> Joshua Slive escribió:
> >
> > Interesting. If what you say is true, then it's a bug in apache, and
> > perhaps one that will be very difficult to fix. You should report it
> > to the bug database. The problem might be that the 304 response
> > doesn't contain a content-type header and therefore can't be activated
> > "ByType".
> >
> I'll report it. I'm not sure it's mandatory that server includes a
> 'Content-Type' header no matter the return code, I'll read about it if I
> hav enough time

No, the content-type header doesn't need to be there, so that's not
the bug, just the immediate cause. The bug might be something to do
with the filter that adds the cache-control stuff acting too late in
the request cycle, after the content-type has been stripped from the
request. I haven't looked into it in detail.

Joshua.

Joshua.

> > Let's see the original and 304 response headers again under this
> > config. Do you have a conflicting Expires header? The Cache-Control:
> > max-age should take precedence, but I wouldn't be surprised if a
> > user-agent didn't do that correctly, since it would be pretty-rare to
> > see them conflict.
> >
> > Also, I suspect that this config would work better:
> > <LocationMatch "\.js$">
> > ExpiresActive On
> > ExpiresDefault "access plus 2 minutes"
> > </LocationMatch>
> >
> Ok, you're right once again. I should have a conflict. The Firefox cache
> expiry date update problem is resolved (in fact, it seems that there was
> never a problem here, but an error of mine). And your solution is
> better, because I suppose it includes an 'Expires' header, compatible
> with possible http 1.0 browsers.
>
> Thanks a lot for your helpful posts
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Bello Martinez Sergio <se...@televes.es>.

Joshua Slive escribió:
>
> Interesting. If what you say is true, then it's a bug in apache, and
> perhaps one that will be very difficult to fix. You should report it
> to the bug database. The problem might be that the 304 response
> doesn't contain a content-type header and therefore can't be activated
> "ByType".
>
I'll report it. I'm not sure it's mandatory that server includes a 
'Content-Type' header no matter the return code, I'll read about it if I 
hav enough time
> Let's see the original and 304 response headers again under this
> config. Do you have a conflicting Expires header? The Cache-Control:
> max-age should take precedence, but I wouldn't be surprised if a
> user-agent didn't do that correctly, since it would be pretty-rare to
> see them conflict.
>
> Also, I suspect that this config would work better:
> <LocationMatch "\.js$">
> ExpiresActive On
> ExpiresDefault "access plus 2 minutes"
> </LocationMatch>
>
Ok, you're right once again. I should have a conflict. The Firefox cache 
expiry date update problem is resolved (in fact, it seems that there was 
never a problem here, but an error of mine). And your solution is 
better, because I suppose it includes an 'Expires' header, compatible 
with possible http 1.0 browsers.

Thanks a lot for your helpful posts

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Joshua Slive <jo...@slive.ca>.
On 7/23/07, Bello Martinez Sergio <se...@televes.es> wrote:
> Ok, thanks. So, the reason of my error was to suppose that including
>
>    <IfModule mod_expires.c>
>                ExpiresActive On
>                ExpiresByType text/javascript "access plus 2 minutes"
>        </IfModule>
>
> (note that the value '2 minutes' is for testing purposes only) would
> apply this header to response even if the return code is 304. That's not
> true.

Interesting. If what you say is true, then it's a bug in apache, and
perhaps one that will be very difficult to fix. You should report it
to the bug database. The problem might be that the 304 response
doesn't contain a content-type header and therefore can't be activated
"ByType".

> So, the solution I tell you in a previous post, thats including
>
>    <LocationMatch "\.js$">
>        Header append Cache-Control "max-age=120"
>    </LocationMatch>
>
> makes Apache to include a 'Cache-Control: max-age=120' header in that
> response. But this is not enough, because it seems that Firefox doesnt
> take into account this header if response code is 304. It set 1970 as
> new expiry date no matter the value in this header.

Let's see the original and 304 response headers again under this
config. Do you have a conflicting Expires header? The Cache-Control:
max-age should take precedence, but I wouldn't be surprised if a
user-agent didn't do that correctly, since it would be pretty-rare to
see them conflict.

Also, I suspect that this config would work better:
<LocationMatch "\.js$">
ExpiresActive On
ExpiresDefault "access plus 2 minutes"
</LocationMatch>

Joshua.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Bello Martinez Sergio <se...@televes.es>.
Ok, thanks. So, the reason of my error was to suppose that including

   <IfModule mod_expires.c>
               ExpiresActive On
               ExpiresByType text/javascript "access plus 2 minutes"
       </IfModule>

(note that the value '2 minutes' is for testing purposes only) would 
apply this header to response even if the return code is 304. That's not 
true.
So, the solution I tell you in a previous post, thats including

   <LocationMatch "\.js$">
       Header append Cache-Control "max-age=120"
   </LocationMatch>

makes Apache to include a 'Cache-Control: max-age=120' header in that 
response. But this is not enough, because it seems that Firefox doesnt 
take into account this header if response code is 304. It set 1970 as 
new expiry date no matter the value in this header.


Joshua Slive escribió:
> On 7/23/07, Bello Martinez Sergio <se...@televes.es> wrote:
>
>> - Headers request/response after expiry time:
>
>>
>>     HTTP/1.x 304 Not Modified
>>     Date: Mon, 23 Jul 2007 17:49:31 GMT
>>     Server: Apache/2.0.54 (Linux/SUSE)
>>     Connection: Keep-Alive
>>     Keep-Alive: timeout=15, max=98
>
> So, here's your problem. The server reports that the resource is not
> modified, but does not send a new Cache-Control: max-age or Expires
> header. The old headers are therefore kept as valid, meaning that the
> resource is not-modified, but expired.
>
> Here's a similar set of headers from apache's core handler:
> Original:
> HTTP/1.1 200 OK
> Date: Mon, 23 Jul 2007 18:11:38 GMT
> Server: Apache/2.3.0-dev (Unix)
> Last-Modified: Wed, 11 Jul 2007 08:03:12 GMT
> ETag: "9276b6-4527-4f313000"
> Accept-Ranges: bytes
> Content-Length: 17703
> Cache-Control: max-age=86400
> Expires: Tue, 24 Jul 2007 18:11:38 GMT
> Vary: Accept-Encoding
> Connection: close
> Content-Type: text/html
>
> If-Modifed-Since request:
> HTTP/1.1 304 Not Modified
> Date: Mon, 23 Jul 2007 18:11:52 GMT
> Server: Apache/2.3.0-dev (Unix)
> ETag: "9276b6-4527-4f313000"
> Expires: Tue, 24 Jul 2007 18:11:52 GMT
> Cache-Control: max-age=86400
> Vary: Accept-Encoding
>
> Note the Cache-Control and Expires headers which update the client's
> freshness info.
>
> Then the question is: why aren't these headers getting sent on your
> 304 responses. I don't know whether this is a problem with your
> application or with apache, but given that I know nothing about your
> app, I'm putting my guess there ;-)
>
> Joshua.
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Joshua Slive <jo...@slive.ca>.
On 7/23/07, Bello Martinez Sergio <se...@televes.es> wrote:

> - Headers request/response after expiry time:

>
>     HTTP/1.x 304 Not Modified
>     Date: Mon, 23 Jul 2007 17:49:31 GMT
>     Server: Apache/2.0.54 (Linux/SUSE)
>     Connection: Keep-Alive
>     Keep-Alive: timeout=15, max=98

So, here's your problem. The server reports that the resource is not
modified, but does not send a new Cache-Control: max-age or Expires
header. The old headers are therefore kept as valid, meaning that the
resource is not-modified, but expired.

Here's a similar set of headers from apache's core handler:
Original:
HTTP/1.1 200 OK
Date: Mon, 23 Jul 2007 18:11:38 GMT
Server: Apache/2.3.0-dev (Unix)
Last-Modified: Wed, 11 Jul 2007 08:03:12 GMT
ETag: "9276b6-4527-4f313000"
Accept-Ranges: bytes
Content-Length: 17703
Cache-Control: max-age=86400
Expires: Tue, 24 Jul 2007 18:11:38 GMT
Vary: Accept-Encoding
Connection: close
Content-Type: text/html

If-Modifed-Since request:
HTTP/1.1 304 Not Modified
Date: Mon, 23 Jul 2007 18:11:52 GMT
Server: Apache/2.3.0-dev (Unix)
ETag: "9276b6-4527-4f313000"
Expires: Tue, 24 Jul 2007 18:11:52 GMT
Cache-Control: max-age=86400
Vary: Accept-Encoding

Note the Cache-Control and Expires headers which update the client's
freshness info.

Then the question is: why aren't these headers getting sent on your
304 responses. I don't know whether this is a problem with your
application or with apache, but given that I know nothing about your
app, I'm putting my guess there ;-)

Joshua.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Bello Martinez Sergio <se...@televes.es>.
Of course. Here you are

- FIREFOX 2.0.0.5 (Headers captured with Live HTTP Headers)

- Headers first request (empty cache) and response:

    GET /javascript/prueba.js HTTP/1.1
    Host: 1.1.2.47
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; 
rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5
    Accept: */*
    Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300   
    Connection: keep-alive
    Referer: https://1.1.2.47pruebaAction.do?metodo=ver
    Cookie: JSESSIONID=E89CF2BB2C4701977149C6FA2157ADF0
    Proxy-Authorization: Basic c2VyYmVsOnNlcmJlbDQ1Ng==

    HTTP/1.x 200 OK
    Date: Mon, 23 Jul 2007 17:47:01 GMT
    Server: Apache/2.0.54 (Linux/SUSE)
    Etag: W/"16577-1184847173000"
    Last-Modified: Thu, 19 Jul 2007 12:12:53 GMT
    Content-Length: 16577
    Cache-Control: max-age=120
    Expires: Mon, 23 Jul 2007 17:49:01 GMT
    Keep-Alive: timeout=15, max=99
    Connection: Keep-Alive
    Content-Type: text/javascript

 
- Corresponding entry in cache after this request/response:

    Key: https://1.1.2.47/javascript/prueba.js
    Data size: 16577 bytes
    Fetch count: 1
    Last modified: 2007-07-23 19:47:00
    Expires: 2007-07-23 19:49:00


- Headers request/response after expiry time:

    GET /javascript/prueba.js HTTP/1.1   
    Host: 1.1.2.47
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; 
rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5
    Accept: */*
    Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Referer: https://1.1.2.47/pruebaAction.do?metodo=ver
    Cookie: JSESSIONID=E89CF2BB2C4701977149C6FA2157ADF0
    If-Modified-Since: Thu, 19 Jul 2007 12:12:53 GMT
    If-None-Match: W/"16577-1184847173000"
    Proxy-Authorization: Basic c2VyYmVsOnNlcmJlbDQ1Ng==

    HTTP/1.x 304 Not Modified
    Date: Mon, 23 Jul 2007 17:49:31 GMT
    Server: Apache/2.0.54 (Linux/SUSE)
    Connection: Keep-Alive
    Keep-Alive: timeout=15, max=98


- Corresponding entry in cache after this request/response

    Key: https://1.1.2.47/javascript/prueba.js
    Data size: 16577 bytes
    Fetch count: 3
    Last modified: 2007-07-23 19:49:30
    Expires: 1970-01-01 01:00:00





- INTERNET EXPLORER 6.0.2800 (Headers captured with HTTP Analyzer Trial 
Version)

- Headers first request (empty cache) and response:

    (Request-Line)    GET /javascript/prueba.js HTTP/1.1
    Accept    */*   
    Referer    https://1.1.2.47/pruebaAction.do?metodo=ver
    Accept-Language    es,en-gb;q=0.7,en-us;q=0.3
    Accept-Encoding    gzip, deflate
    User-Agent    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; 
.NET CLR 1.1.4322)
    Host    1.1.2.47
    Connection    Keep-Alive
    Cookie    JSESSIONID=4E544B170E5C44AF97FC979362F8C457


    Response Headers    Value
    (Status-Line)    HTTP/1.0 200 OK   
    Date    Mon, 23 Jul 2007 17:54:24 GMT
    Server    Apache/2.0.54 (Linux/SUSE)
    ETag    W/"16577-1184847173000"
    Last-Modified    Thu, 19 Jul 2007 12:12:53 GMT   
    Content-Length    16577
    Cache-Control    max-age=120
    Expires    Mon, 23 Jul 2007 17:56:24 GMT
    Connection    close
    Content-Type    text/javascript


- Headers request/response after expiry time:

    Request Headers    Value
    (Request-Line)    GET /javascript/prueba.js HTTP/1.1
    Accept    */*
    Referer    https://1.1.2.47/pruebaAction.do?metodo=ver
    Accept-Language    es,en-gb;q=0.7,en-us;q=0.3
    Accept-Encoding    gzip, deflate
    If-Modified-Since    Thu, 19 Jul 2007 12:12:53 GMT; length=16577
    User-Agent    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; 
.NET CLR 1.1.4322)
    Host    1.1.2.47
    Connection    Keep-Alive
    Cookie    JSESSIONID=4E544B170E5C44AF97FC979362F8C457


    Response Headers    Value
    (Status-Line)    HTTP/1.0 304 Not Modified
    Date    Mon, 23 Jul 2007 17:56:42 GMT
    Server    Apache/2.0.54 (Linux/SUSE)
    Connection    close


In the case of IE the cache entry remains the same (it only updates 
'last access' and 'last check', but never 'expiry time' (sorry if these 
titles are not correct, I'm using an Spanish IE and I've transate them 
directly)
Thanks,

Sergio



Joshua Slive escribió:
> On 7/23/07, Bello Martinez Sergio <se...@televes.es> wrote:
>> Thanks again, Joshua.
>> You are right, it's my application that set 'must-revalidate' header.
>> But it's not the problem, I've deleted it and all works exactly the 
>> same.
>> I suspect the 304 return code is the reason because Firefox set
>> '1970-01-01 01:00:00 (already expired)" expiry date, and not that 
>> header.
>> I've found a "half-solution". If I use a 'Header append Cache-Control
>> "max-age=something"' , Apache inserts this header in response, even if
>> return code is 304 (until now I've used only 'ExpiresByType' to set
>> cache-related headers).
>> In this case, if Internet Explorer 6.0 receives max-age header, it
>> updates correctly cache-entry expiry time, but Firefox still updates it
>> to '1970-01-01 01:00:00 '. I'll search a litte more....
>
> I'd like to see full request/response headers for these cases
> (original and 304), because I can't really believe that MSIE and
> firefox are broken enough to not properly update their cache on a 304
> in the typical case.
>
> Joshua.
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Joshua Slive <jo...@slive.ca>.
On 7/23/07, Bello Martinez Sergio <se...@televes.es> wrote:
> Thanks again, Joshua.
> You are right, it's my application that set 'must-revalidate' header.
> But it's not the problem, I've deleted it and all works exactly the same.
> I suspect the 304 return code is the reason because Firefox set
> '1970-01-01 01:00:00 (already expired)" expiry date, and not that header.
> I've found a "half-solution". If I use a 'Header append Cache-Control
> "max-age=something"' , Apache inserts this header in response, even if
> return code is 304 (until now I've used only 'ExpiresByType' to set
> cache-related headers).
> In this case, if Internet Explorer 6.0 receives max-age header, it
> updates correctly cache-entry expiry time, but Firefox still updates it
> to '1970-01-01 01:00:00 '. I'll search a litte more....

I'd like to see full request/response headers for these cases
(original and 304), because I can't really believe that MSIE and
firefox are broken enough to not properly update their cache on a 304
in the typical case.

Joshua.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Bello Martinez Sergio <se...@televes.es>.
Thanks again, Joshua.
You are right, it's my application that set 'must-revalidate' header. 
But it's not the problem, I've deleted it and all works exactly the same.
I suspect the 304 return code is the reason because Firefox set 
'1970-01-01 01:00:00 (already expired)" expiry date, and not that header.
I've found a "half-solution". If I use a 'Header append Cache-Control 
"max-age=something"' , Apache inserts this header in response, even if 
return code is 304 (until now I've used only 'ExpiresByType' to set 
cache-related headers).
In this case, if Internet Explorer 6.0 receives max-age header, it 
updates correctly cache-entry expiry time, but Firefox still updates it 
to '1970-01-01 01:00:00 '. I'll search a litte more....
Thanks,

Sergio



Joshua Slive escribió:
> On 7/23/07, Bello Martinez Sergio <se...@televes.es> wrote:
>> Thank you for your respose.
>> I've checked that browsers don´t work as you say they're supposed to
>> work. When Apache aswers with a 304 response, the only cache-related
>> header it includes by default into the response is 'Cache-Control:
>> must-revalidate'.
>> Internet Explorer 6.0 does nothing with it, after receiving this
>> response, cache remains the same (entity expiry dates remains the same)
>> so each time browser needs those elements, it sends a new http request
>> an it receives a new 304 response. In the case of Firefox 2.0, the cache
>> is updated, but not in the way I'd like: instead of this, entity's
>> expiry date are updated to '1970-01-01 01:00:00', so the result is the
>> same, each time the browser needs one of these elements, we have a
>> request-304 response (with a worse performance)
>
> must-revalidate is certainly not something that apache returns by
> default or with the default handler. In fact, no cache-control
> parameters are set by default. So I think you need to examine your
> application.
>
> Although must-revalidate should technically not effect the caching
> decision of the client in most cases, it is a widely abused parameter
> and it wouldn't surprise me at all if clients treat this as marking
> the response as instantly stale. I would therefore guess that your
> problem would be eliminated if you dropped this parameter.
>
> Joshua.
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Joshua Slive <jo...@slive.ca>.
On 7/23/07, Bello Martinez Sergio <se...@televes.es> wrote:
> Thank you for your respose.
> I've checked that browsers don´t work as you say they're supposed to
> work. When Apache aswers with a 304 response, the only cache-related
> header it includes by default into the response is 'Cache-Control:
> must-revalidate'.
> Internet Explorer 6.0 does nothing with it, after receiving this
> response, cache remains the same (entity expiry dates remains the same)
> so each time browser needs those elements, it sends a new http request
> an it receives a new 304 response. In the case of Firefox 2.0, the cache
> is updated, but not in the way I'd like: instead of this, entity's
> expiry date are updated to '1970-01-01 01:00:00', so the result is the
> same, each time the browser needs one of these elements, we have a
> request-304 response (with a worse performance)

must-revalidate is certainly not something that apache returns by
default or with the default handler. In fact, no cache-control
parameters are set by default. So I think you need to examine your
application.

Although must-revalidate should technically not effect the caching
decision of the client in most cases, it is a widely abused parameter
and it wouldn't surprise me at all if clients treat this as marking
the response as instantly stale. I would therefore guess that your
problem would be eliminated if you dropped this parameter.

Joshua.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Bello Martinez Sergio <se...@televes.es>.
Thank you for your respose.
I've checked that browsers don´t work as you say they're supposed to 
work. When Apache aswers with a 304 response, the only cache-related 
header it includes by default into the response is 'Cache-Control: 
must-revalidate'.
Internet Explorer 6.0 does nothing with it, after receiving this 
response, cache remains the same (entity expiry dates remains the same) 
so each time browser needs those elements, it sends a new http request 
an it receives a new 304 response. In the case of Firefox 2.0, the cache 
is updated, but not in the way I'd like: instead of this, entity's 
expiry date are updated to '1970-01-01 01:00:00', so the result is the 
same, each time the browser needs one of these elements, we have a 
request-304 response (with a worse performance)

Joshua Slive escribió:
> On 7/20/07, Bello Martinez Sergio <se...@televes.es> wrote:
>> Hi all,
>> I've configured Apache so that some elements (i.e. .js, .gif, .jpeg,
>> etc) are stored in browser's cache during a time. When I access to a
>> page contaning any of those elements, the browser doesn´t make a request
>> to the server, it get the content from cache instead. Until this moment,
>> all is ok.
>> The problem arises when the time I chose for element's caching finishes.
>> After this moment, each time the browser need one of those cached
>> elements, It makes a http request to the server and the response
>> includes a 304 error (I know it´s not an error, only a 'not modified'
>> message). The problem is that when a page contains many of these
>> elements (.js, .gif, etc), performance get worse (pairs request-reponse
>> 304 take time), and there isn't a way to tell the browser to use cache's
>> information again, unless you modify files at server side.
>> So I want to know or if there is a way to configure Apache so that
>> browsers renew cache's elements expiry date when they receive a 304
>> error, or to configure Apache to not to answer with error 304, but to
>> reply with the corresponding file, even though this file's been not
>> modified.
>
> Hmmm... By default, the 304 response should update any Expires or
> Cache-Control response headers, and the client should update its cache
> based on these new headers (or should recalculate expiry based on the
> new response Date). If the client is not updating its cache after the
> 304 response, that sounds like a problem at the client.
>
> To directly answer your question, I'm not sure if there is an easy way
> to entirely turn off 304 responses. You could probably do
> RequestHeader unset If-Modified-Since early
> or you could activate mod_include processing for the files (but that
> would be a waste of processor time).
>
> Joshua.
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Want to avoid 304 error

Posted by Joshua Slive <jo...@slive.ca>.
On 7/20/07, Bello Martinez Sergio <se...@televes.es> wrote:
> Hi all,
> I've configured Apache so that some elements (i.e. .js, .gif, .jpeg,
> etc) are stored in browser's cache during a time. When I access to a
> page contaning any of those elements, the browser doesn´t make a request
> to the server, it get the content from cache instead. Until this moment,
> all is ok.
> The problem arises when the time I chose for element's caching finishes.
> After this moment, each time the browser need one of those cached
> elements, It makes a http request to the server and the response
> includes a 304 error (I know it´s not an error, only a 'not modified'
> message). The problem is that when a page contains many of these
> elements (.js, .gif, etc), performance get worse (pairs request-reponse
> 304 take time), and there isn't a way to tell the browser to use cache's
> information again, unless you modify files at server side.
> So I want to know or if there is a way to configure Apache so that
> browsers renew cache's elements expiry date when they receive a 304
> error, or to configure Apache to not to answer with error 304, but to
> reply with the corresponding file, even though this file's been not
> modified.

Hmmm... By default, the 304 response should update any Expires or
Cache-Control response headers, and the client should update its cache
based on these new headers (or should recalculate expiry based on the
new response Date). If the client is not updating its cache after the
304 response, that sounds like a problem at the client.

To directly answer your question, I'm not sure if there is an easy way
to entirely turn off 304 responses. You could probably do
RequestHeader unset If-Modified-Since early
or you could activate mod_include processing for the files (but that
would be a waste of processor time).

Joshua.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org