views:

55

answers:

1

We have a Rails app that instantiates a SWF object 16 times (it has to do this, it's just the nature of the application). Instead of being downloaded once, it is being downloaded 16 times.

How can we ensure this SWF is cached by the browser the first time it is downloaded? It's being served directly from Apache - can we modify the HTTP headers to accomplish this?

Some information:

  • Browser caching the resources with code 304.

  • Domain points to cluster and traffic is forwarded to two servers(.3 and .4) in the cluster.

  • Each server has own copy of the code with different timestamp of the files.

  • If there are any subsequent requests to the SWF then chances are that .3 or .4 may serve and browser treats image as modified on the server since image file timestamp is different.

Any help would be appreciated, as it would greatly improve the app's performance after the initial load.

A: 

Try to set the Expires header to a high enough value. also adding Cache-Control: max_age=<some high number> will help.

Apache's mod_expires will help with all of that.

Guss