[RESOLVED] Expires Headers for images in stylesheets

Discussion in 'Install/Configuration' started by ideaoforder, Mar 1, 2010.

  1. ideaoforder

    ideaoforder New Member

    Hello, I have expires headers enabled with the default settings in a Rails app. Everything is working as expected, except for images loaded from stylesheets (i.e. style.css > background: url(/images/something.png);). These don't get expires headers and thus aren't getting cached.

    Is there a setting I have to change to get add expires headers to these as well?

    Thanks!
  2. mistwang

    mistwang LiteSpeed Staff

  3. ideaoforder

    ideaoforder New Member

    Just Stylesheets

    I currently have:

    image/*=A604800, text/css=A604800, application/x-javascript=A604800

    which should cover pngs. All images embedded in the html have proper expires headers--it's just the ones in the stylesheet that seem to have a problem.
  4. mistwang

    mistwang LiteSpeed Staff

    what is in the response header when you access the file directly? check from firebug.
  5. ideaoforder

    ideaoforder New Member

    Last-Modified Mon, 01 Mar 2010 17:51:42 GMT
    Content-Type image/png
    Content-Length 7350
    Date Mon, 01 Mar 2010 21:39:01 GMT
    Server LiteSpeed
  6. mistwang

    mistwang LiteSpeed Staff

    If you access it again by hitting enter from browser address bar, not using refresh, will you get 304 response?

    I wonder if the request was served by rails dynamically.
  7. mistwang

    mistwang LiteSpeed Staff

    You can also try add "image/png=A604800" explicitly, it does not hurt anything.
  8. ideaoforder

    ideaoforder New Member

    You were right

    Excellent call! The images in question were being served by Rails dynamically--in this case because of an overzealous rewrite rule. Thanks so much! I don't know that I would have caught that.

Share This Page