Questions about the expires header

  • If the response does not expire the HTTP header, what does this mean for browsers?
  • In Glassfish v3, how to configure the expires header for static resources that were deployed under docroot not as a war file?
  • I noticed that Glassfish sets the ETag header by default. It's true? The ultimate goal that I want to achieve here is to set a future header ending in the future, but the ability to tell browsers “there is new material” whenever a new version of css, js, image files is deployed.

Thanks so much for any advice.

+3
source share
5 answers

expires, , . §14.21: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

, expires max-age, , expires max-age. , . §13.2.4: http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.2.4 , .

, , HTML. . : http://www.tipsandtricks-hq.com/how-to-add-far-future-expires-headers-to-your-wordpress-site-1533

: " , CSS, javascript .htaccess

Expire Header

> <FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
> ExpiresDefault "access plus 2 hours"
> </FilesMatch>

Expire images

> ExpiresActive On 
> ExpiresDefault A0
> ExpiresByType image/gif A2592000

[...] , expires, , , . / (, CSS javascript ), , .

+2

, Expires, . , .

3, , , ( javascript , ), . , site.css

<link rel="stylesheet" href="site.css?lastmodified=20110605">

<link rel="stylesheet"
  href="site.css?sha1sum=da39a3ee5e6b4b0d3255bfef95601890afd80709">
0

, , .

  • "expires" , . , , , Last-Modified, expires , , .
  • expires , (, ). . , Last-Modified , , , If-Modified-Since, 304 Not Modified, . Last-Modified - ( )
0

All Articles