On Tue, Dec 30, 2008 at 12:48 PM, André Warnier <aw@xxxxxxxxxx> wrote: > Hi. > > I am a bit at my wit's end here. > > Using Apache 2.2.3 under Suse Linux, with a mod_jk re-director to Tomcat for > certain links, such as the one of which question below. > > I am using a Tomcat java application which unfortunately sets the > Content-Type response header wrongly : it says "text/html; > charset=iso-8859-1" instead of "text/html; charset=iso-8859-2", and there is > no way I can change that application itself. > So I am trying to rectify that header after-the-fact, using mod_headers. > Unfortunately, it does not seem to work. > > I have this Vhost configuration (snippet) : > > SetEnvIf REQUEST_URI "/servlet\.[^\.]+$" is-jk > Header always set Content-Type: "text/html; charset=ISO-8859-2" env=is-jk > Header always set Test-Header: "VHost level" env=is-jk > > <LocationMatch "/servlet\.[^.]+$"> > SetHandler jakarta-servlet > Header always set Content-Type: "text/html; charset=ISO-8859-2" > Header always set Test-Header: "Location level" > </LocationMatch> > > I capture the HTTP headers resulting from a request, using the > LiveHttpHeaders plugin of Firefox, as follows (sorry for the email > wrap-around, and sensitive bits edited-out with XXX): > > POST /starweb/XXX/servlet.starweb HTTP/1.1 > Host: XXX.XXX.XXX > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.15) > Gecko/20080623 Firefox/2.0.0.15 > Accept: > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > Accept-Language: en-gb,en;q=0.7,de-de;q=0.3 > Accept-Encoding: gzip,deflate > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > Keep-Alive: 300 > Connection: keep-alive > Referer: > http://XXXX/starweb/wideoteka/servlet.starweb?path=wideoteka/wideoteka-sso.web&auth=y > Cookie: XXXX, JSESSIONID=3AD2CE2435CDCC2CFD3C90D7DF23868B > Pragma: no-cache > Cache-Control: no-cache > Content-Type: application/x-www-form-urlencoded > Content-Length: 273 > > HTTP/1.x 200 OK > Date: Tue, 30 Dec 2008 17:30:33 GMT > Server: Apache/2.2.3 (Linux/SUSE) mod_jk/1.2.28-dev-727724 mod_perl/2.0.2 > Perl/v5.8.8 > Content-Type: text/html;charset=ISO-8859-1 > Test-Header: Location level > Expires: Mon, 26 Jul 1997 05:00:00 GMT > Pragma: no-cache > Keep-Alive: timeout=15, max=100 > Connection: Keep-Alive > Transfer-Encoding: chunked > > > As can be seen above, the "Test-Header" that I set with mod_headers comes > out perfectly, from the Location section. > But the Content-Type header, which I believe should be set in the same exact > conditions, does not. > > Does anyone have an idea why ? Headers generated by Apache late during processing (read: after mod_headers acts!) will overlay what you've set. Things like Content-Encoding, Content-Type, Server, etc. Maybe ForceType would convince the piece of the core Apache to set the proper header while it's doing its work. -- Eric Covener covener@xxxxxxxxx --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx