Thanks for the quick reply, Rainer. Yes a servlet filter makes sense, though not as easy as a one-liner httpd directive.
I guess my immediate response is surprise that (since this must be a common problem with so many poorly written web-clients doing content-negotiation so badly out in the big-wide-web) that there aren't any stock servlet filters already written that I can use "out of the box". Does anyone know of any? I will try the experiment of writing a servlet filter (it will do me good to learn all this, and I can imagine other useful things I might do) and if I get something that might be useful for others I will let you know. Richard On Thu, 2007-06-21 at 17:14 +0200, Rainer Jung wrote: > I had a similar problem with mod_prox and mod_headers for Apache httpd > 2.2 today, and I would expect, that changing the headers with mod_header > does not work. > > I see no easy way (but maybe others out there). You could hack > > ajp_unmarshal_response() in common/jk_ajp_common.c. > > Alternative: experiment with a servlet filter for Tomcat. You can always > add filters to webapps without changing or even having the webapp code > itself. > > Regards, > > Rainer > > Richard Kaye wrote: > > Hi > > > > I am using Tomcat5.5, Apache2.2 and mod_jk1.2 > > and a third-part servlet which I can't re-program or > > configure. > > > > I need to sniff the HTTP "User-Agent" and/or "Accept" > > fields and change the content-type > > (currently "text/html;charset=UTF-8") that the > > servlet returns based on these. > > > > using mod_headers and mod_setenvif, I currently > > have (in my apache2 config) something like: > > > > SetEnvIf User-Agent Whatever DETECTED1 > > SetEnvIf Accept Somethingelse DETECTED2 > > JkMount /servletname/* ajp13_worker > > <LocationMatch /servletname/* > > > Header set Content-Type "text/xml" env=DETECTED1 > > Header set Content-Type "application/xml" env=DETECTED2 > > </LocationMatch> > > > > Unfortunately, it doesn't work. Specifically, I always get the > > document served as "Content-Type: text/html;charset=UTF-8" > > and not "Content-Type: text/xml" as expected. From googling a bit > > I have learnt that the mod_headers module won't set the Content-Type > > header, because this one is set internally by apache at a later stage. > > But I couldn't find a workaround or alternative that does what I want. > > > > Help please! > > > > And many thanks... > > > > Richard > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]