varnish + multiple webheads = files/(css/*.css|js/*.js) missing I have this weird issue and I'm not sure if it's me who's doing something wrong or I'm just missing something but maybe some of you can guide me a little bit here...

i setup a varnish server, within varnish itself i created 2 backends and using director i'm able to do round robin to my webheads. That parts seems to be working fine as I'm able to bring one of my webheads down and the other one can serve content to varnish and vice verse.

but here is a kicker... i noticed that sometimes page doesn't load properly so i start looking into why and I noticed some of the files are 304 or 404, so turns out somehow some of files in (files/css/.css or files/js/.js are missing), so I rsync them so now they all appears to have same content in those directories, but when i go to another page it seems like drupal generates more of those and since varnish goes to a round robin for any hit it serves some of page from one webhead and another part from another, so even though css,js file has been generated on first webhead it not generated on second and hence shows 304 or 404.

please advise
This is happening when you have optimization for CSS/JS turned on. These files are generated regarding the context (the page visited by the browser) and so the visitor won't be served some files when the round robin changed the targeted server.

You can configure the round robin to stay on the same server on a per-session basis (see: Pure VCL cookie-based sticky sessions in Varnish 2.1), but generally you should set up a NFS share between your server where you'll put the sites/default/files folder.

Source: Drupal's optimize CSS and JavaScript setting causing problems in multiple server environments.