Hi Tim, If you are after caching the responses, maybe an easier solution would be to use a reverse proxy - like Varnish?
You would be then in complete control over the incoming and outgoing headers and could cache responses based on the url / inject Expires headers so browsers could cache them too etc. Cheers, Alex On 14/07/11 11:39, Tim Watts wrote: > On 14/07/11 11:16, André Warnier wrote: > > Hi Andre, > > Thanks for the quick reply :) > >> (That would probably be difficult, inefficient or both) >> >> Assuming that what you say about Tomcat is true (I don't know, and it >> may be worth asking this on the Tomcat list), I can think of another way >> to achieve what you seem to want : >> if you can distinguish, from the request URL (or any other request >> property), the requests that are for invariant things, then you could >> arrange to /not/ proxy these requests to Tomcat, and serve them directly >> from Apache httpd. > > Indeed that is a good idea. We are doing that for new projects for css > and js files (apache does not proxy certain paths and picks these up > from the local filesystem). > > We can't do that for the 100 odd legacy servers as no-one has time o > delve into the java/JSP code. I need to do something "outside" of > tomcat where possible. Just to explain, each web server is a paid-for > project - and when it's done, it sits there for 5+ years. > > Only I have the time/inclination to fix this as it's killing my VMWare > infrastructure. Because the sites are all fronted by apache in a > similar way, one solution is likely to apply to most of the sites. > > I would also add that most of the sites are "dynamically" driven > pages, even involving MySQL querying, but once launched, the data > remains fairly static - eg GET X will always resolve to reponse Y. > > I'm planning a small seminar on the value of Cache-Control for my dev > colleagues so they can stop making this mistake ;-> But that still > leaves a lot of "done" projects to fix. > >> Which proxying method exactly are you using between Apache and Tomcat ? >> (if you are using mod_proxy, then you are either using mod_proxy_http or >> mod_proxy_ajp; you could also consider using mod_jk). > > mod_proxy_http specifically. > > mod_jk looks interesting for new projects (we have local tomcats for > those now) - I think it may be a non-starter for old stuff as trying > to retro fit it may not be so simple (our older tomcat servers are in > a remote farm on their own machines hence the use of mod_proxy_http). > >> Also, what are the versions of Apache and Tomcat that you are using ? >> > > Apache 2.2 (various sub versions) and both tomcat 5.5 and tomcat 6 > (but all on remote machines listening on TCP sockets). > > I think for this problem, I have to treat tomcat as a little, rather > inefficient, black box and try to fixup on the apache front ends, > hence the direction of my original idea... > > Cheers, > > Tim >