In our project, we have a whole bunch of small css/js files, so when we build views we find ourselves writing many <link>
or <script>
tags, forcing the browser to make many requests for our css/js content. To remedy this, we started looking for a way for server to shore that all up into one request that dumps every css file or every js file associated with the action into the response.
Without going into too much detail, we created a Helper class that accepts the files, concatenates them, and renders a tag like so:
<script type="text/javascript" src="/content/js15628453.rails"></script>
The ContentController then has a default action which uses 'js15628453' to find where the Helper stored the concatenated file and streams it out. This works really well.
However, as Firebug reports it, the browser always sends a request to "/content/js15628453.rails" to get the concatenated file, despite the fact that the URL is always the same and the response is always the same. I've tried all types of combinations of the HTTP Cache-Control
, Expires
, Last-Modified
, etc headers, but have yet to get something that Firebug reports as loaded from the cache.
Why might the browser be ignoring those headers? Are there any other options I can try to force it to be cached?