i'm trying to understanding if is it possibile to avoid request for some embedded objects, loading them directly from cache without asking to web server if the object is valid or not (i don't wont web server response to me with 304 http status code) Is it possible ? Does the expire header works for this way? How?
From my htaccess.
# cache images/pdf docs for 10 days
<FilesMatch "\.(ico|pdf|jpg|jpeg|png|gif|js)$">
Header set Expires "Mon, 31 Dec 2035 12:00:00 gmt"
</FilesMatch>
# cache html/htm/xml/txt diles for 2 days
<FilesMatch "\.(html|htm|xml|txt|xsl)$">
Header set Cache-Control "max-age=7200"
</FilesMatch>
</IfModule>
Similar operation with php header function and also in httpd.conf.
I verify the results in the apache access.log. Every time i refresh the page in the access.log file appear the 304 request. So, i think the browser always make the request.
Yes, you should use
Expires
orCache-Control: max-age
headers to prevent browser from requesting objects again. See RFC 2616 for details.