tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject [users@httpd] Problem with mod_headers ?
Date Tue, 30 Dec 2008 19:27:39 GMT
Hi.

The following is verbatim what I posted earlier on the Apache user's 
list.  I am reposting it here because I did not really get a 
"satisfactory" answer on the Apache httpd list, and because I know that 
mod_jk experts lurk around here. And maybe this has something to do with 
the fact that the requests we're talking about are handled by a Tomcat 
webapp, after being re-directed by Apache/mod_jk.

The underlying question is also : despite what I'm saying below about 
not being able to change the webapp (which is basically true), I think I 
should be able to change the Content-Type header (which I believe is 
generated by the rogue webapp or by Tomcat itself), *before* it gets 
sent back to Apache via mod_jk.
And I guess that in order to do that, I would have to create a servlet 
filter that acts at the output level.  How hard would that be to do ?

(I already have a servlet filter around this webapp, but at the moment 
it only acts on the input side).


Original message to Apache list follows :

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 
(5.0.x) 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 ?

Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message