Lentes, Bernd wrote:
Hi,

first, i'm new to tomcat and i'm not a java developer.

You have all my sympathy.

My collegues developed a web application i have to deploy now. I'm using 
tomcat6 on a sles 11 sp1 box.
I configured a httpd (apache 2.2.10) in front of the tomcat, which communicates 
with tomcat using AJP.
When i open one link, i don't see the desired web page, but the source code of 
it. Using tcpdump shows me that the content type in the http-header is 
text/plain.

That is typical of a bad/dangerous configuration of Apache, mod_jk and Tomcat.
You are probably
a) allowing Apache to "see" the contents of the Tomcat webapps directory 
directly
(e.g. by setting the Apache DocumentRoot = the Tomcat webapps dir.)
b) not properly indicating to Apache/mod_jk that these URLs must be proxied to Tomcat via mod_jk (JkMount instructions).

As a consequence, when you request from Apache a URL like (for example) "/myapp/something.jsp", Apache goes directly to that file and serves it back to the browser. Of course since Apache does not know what a .jsp file is, it treats it as plaint text and that is what it says in the Content-type header.


Do the following test to confirm the above :
request the URL "/myapp/WEB-INF/web.xml"
(where "myapp" is the first part of the URL for a Tomcat application).
If you see the content of the web.xml file in the browser, then the above is probably true, because Tomcat would never show the content of that file (or anything else in a WEB-INF directory).

(The reason why I mention above that it is "dangerous", is that by doing that you also allow Apache to completely go around whatever access security would be configured in Tomcat.)

Ok, that's the reason why i see the source code.

Yes

Can i configure the content-type which is delivered by tomcat ?

You can, but you should not have to, because it is not the problem here.
Tomcat never receives the request for that file; it is Apache only which reads that file and sends it back. So changing something in Tomcat won't help.

I tried using mod_mime_magic on httpd,
but this module just helps specifying the content-type of static files. Our content is dynamic.

Yes, and that is like putting new paint on top of schimmel.
You should fix the configuration first.

If you want further help, give us an idea of the layout on disk of your Apache and Tomcat directories, and of the URLs that should be processed by Tomcat.



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

Reply via email to