You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by newToMina <as...@yahoo.com> on 2009/04/07 17:24:47 UTC

Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

I have jsp page which displays fine when I access it directly from tomcat.
But when the page is access through apache (mod_jk) it displays the source
code. This is happening only on Firefox and on IE it works fine. Firefox is
rendering the page in quirk mode when accessed through apache and rendering
in standard complaince mode when accessed directly from tomcat. 
OS: Opensuse 10
Tomcat: 5.5.20
apache: 2.0.59 (Unix) (mod_jk/1.2.19)

The following is the response headers for apache and tomcat.

Direct from tomcat:
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=61DB0770967F2681728FFFF73F742C37; Expires=Thu,
01-Jan-1970 00:00:10 GMT
JSESSIONID=A279CC9DD911FC575BFFDEC7837E371F; Path=/appname
Expires: Sat, 6 May 1995 12:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 2418
Date: Tue, 07 Apr 2009 14:55:42 GMT

200 OK

Same page accessed through apache:
Date: Tue, 07 Apr 2009 14:56:23 GMT
Server: Apache/2.0.59 (Unix) DAV/2 SVN/1.4.0 mod_jk/1.2.19
Set-Cookie: JSESSIONID=9D1D989BFF39342075436442AE3291D9; Expires=Thu,
01-Jan-1970 00:00:10 GMT
JSESSIONID=A2E8A86EDB48255780784AE916B4775E; Path=/appname
Expires: Sat, 6 May 1995 12:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Content-Length: 2418
Keep-Alive: timeout=15, max=97
Connection: Keep-Alive
Content-Type: text/html;charset=ISO-8859-1

200 OK
-- 
View this message in context: http://www.nabble.com/Jsp-working-fine-from-tomcat%2C-but-displaying-source-when-accessed-through-apache-%28Only-on-Firefox%29-tp22931646p22931646.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by bcaramu <bc...@gmail.com>.
set response.contentType(text/html"), then it works



newToMina wrote:
> 
> I have jsp page which displays fine when I access it directly from tomcat.
> But when the page is access through apache (mod_jk) it displays the source
> code. This is happening only on Firefox and on IE it works fine. Firefox
> is rendering the page in quirk mode when accessed through apache and
> rendering in standard complaince mode when accessed directly from tomcat. 
> OS: Opensuse 10
> Tomcat: 5.5.20
> apache: 2.0.59 (Unix) (mod_jk/1.2.19)
> 
> The following is the response headers for apache and tomcat.
> 
> Direct from tomcat:
> Server: Apache-Coyote/1.1
> Set-Cookie: JSESSIONID=61DB0770967F2681728FFFF73F742C37; Expires=Thu,
> 01-Jan-1970 00:00:10 GMT
> JSESSIONID=A279CC9DD911FC575BFFDEC7837E371F; Path=/appname
> Expires: Sat, 6 May 1995 12:00:00 GMT
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
> pre-check=0
> Pragma: no-cache
> Content-Encoding: gzip
> Content-Type: text/html;charset=ISO-8859-1
> Content-Length: 2418
> Date: Tue, 07 Apr 2009 14:55:42 GMT
> 
> 200 OK
> 
> Same page accessed through apache:
> Date: Tue, 07 Apr 2009 14:56:23 GMT
> Server: Apache/2.0.59 (Unix) DAV/2 SVN/1.4.0 mod_jk/1.2.19
> Set-Cookie: JSESSIONID=9D1D989BFF39342075436442AE3291D9; Expires=Thu,
> 01-Jan-1970 00:00:10 GMT
> JSESSIONID=A2E8A86EDB48255780784AE916B4775E; Path=/appname
> Expires: Sat, 6 May 1995 12:00:00 GMT
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
> pre-check=0
> Pragma: no-cache
> Content-Encoding: gzip
> Content-Length: 2418
> Keep-Alive: timeout=15, max=97
> Connection: Keep-Alive
> Content-Type: text/html;charset=ISO-8859-1
> 
> 200 OK
> 
> Any help is greatly appreciated...
> 

-- 
View this message in context: http://old.nabble.com/Jsp-working-fine-from-tomcat%2C-but-displaying-source-when-accessed-through-apache-%28Only-on-Firefox%29-tp22931646p29427045.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by André Warnier <aw...@ice-sa.com>.
newToMina wrote:
> Mark,
> 
> I changed JKMount as you suggested. But firefox is still displaying the
> source when accessing through apache. Direct tomcat access displays fine.
> Firefox is rendering the page as follows:
> 
> Direct from tomcat (http://server:8080/appname/servlet/Controller)
> Type : text/html
> Render Mode: Standards compliance mode
> 
> Access tomcat through apache (http://server/appname/servlet/Controller)
> Type : text/plain
> Render Mode: Quirks mode
> 
> Could any one please help me with this?
> 
Somehow, I get the feeling that you have done what you should /never/ 
do, which is to allow Apache to access the Tomcat files directly.
Where does your Apache DocumentRoot point to ?
Or what Alias(es) have you used ?
To prove this point :
- turn off Tomcat
- re-try your URL http://server/appname/servlet/Controller...

are you still getting something ?


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


Re: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by newToMina <as...@yahoo.com>.
Mark,

I changed JKMount as you suggested. But firefox is still displaying the
source when accessing through apache. Direct tomcat access displays fine.
Firefox is rendering the page as follows:

Direct from tomcat (http://server:8080/appname/servlet/Controller)
Type : text/html
Render Mode: Standards compliance mode

Access tomcat through apache (http://server/appname/servlet/Controller)
Type : text/plain
Render Mode: Quirks mode

Could any one please help me with this?


markt-2 wrote:
> 
> newToMina wrote:
>> Mark, could you please explain it a little more detail and provide an
>> example
>> of the proper JKmount entries. Thanks in advance ...
> 
> Replace what you have previously with:
> 
> JkMount /appname/* tomcat5
> JkMount /appname   tomcat5
> 
> Note this means you do not use the Alias or Directory settings you had
> previously.
> 
> Mark
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Jsp-working-fine-from-tomcat%2C-but-displaying-source-when-accessed-through-apache-%28Only-on-Firefox%29-tp22931646p24111800.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by newToMina <as...@yahoo.com>.
Thanks Mark... I will try this and update the post.
-- 
View this message in context: http://www.nabble.com/Jsp-working-fine-from-tomcat%2C-but-displaying-source-when-accessed-through-apache-%28Only-on-Firefox%29-tp22931646p22934602.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by Mark Thomas <ma...@apache.org>.
newToMina wrote:
> Mark, could you please explain it a little more detail and provide an example
> of the proper JKmount entries. Thanks in advance ...

Replace what you have previously with:

JkMount /appname/* tomcat5
JkMount /appname   tomcat5

Note this means you do not use the Alias or Directory settings you had
previously.

Mark



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


Re: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by newToMina <as...@yahoo.com>.
Mark, could you please explain it a little more detail and provide an example
of the proper JKmount entries. Thanks in advance ...
-- 
View this message in context: http://www.nabble.com/Jsp-working-fine-from-tomcat%2C-but-displaying-source-when-accessed-through-apache-%28Only-on-Firefox%29-tp22931646p22933197.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by Mark Thomas <ma...@apache.org>.
newToMina wrote:
> Thanks for the reply.  The JK mount is difined as follows. The wired thing is
> that first couple of page of the application is working fine. Only a
> purticular page is giving this problem. (the response headers were for this
> page). I have no clue on why is it happening. For some reason the firefox
> render this page in quirk mode when accessing through apache.
> 
> # appname
> JkMount /appname/servlet/* tomcat5
> JkMount /appname/*.jsp tomcat5
> Alias /appname "/usr/local/tomcat5/webapps/appname"
> <Directory "/usr/local/tomcat5/webapps/appname">
>     Options FollowSymLinks
>     AllowOverride None
>     Order allow,deny
>     Allow from all
> </Directory>

And there is the problem. Configuring httpd and Tomcat to serve content
from the same part of the file system is asking for trouble.
/WEB-INF/web.xml is probably exposed too.

Don't configure httpd to serve content from Tomcat's appBase and you'll
be fine.

Mark


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


RE: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by newToMina <as...@yahoo.com>.
Thanks for the reply.  The JK mount is difined as follows. The wired thing is
that first couple of page of the application is working fine. Only a
purticular page is giving this problem. (the response headers were for this
page). I have no clue on why is it happening. For some reason the firefox
render this page in quirk mode when accessing through apache.

# appname
JkMount /appname/servlet/* tomcat5
JkMount /appname/*.jsp tomcat5
Alias /appname "/usr/local/tomcat5/webapps/appname"
<Directory "/usr/local/tomcat5/webapps/appname">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
-- 
View this message in context: http://www.nabble.com/Jsp-working-fine-from-tomcat%2C-but-displaying-source-when-accessed-through-apache-%28Only-on-Firefox%29-tp22931646p22932884.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Jsp working fine from tomcat, but displaying source when accessed through apache (Only on Firefox)

Posted by Peter Crowther <Pe...@melandra.com>.
> From: newToMina [mailto:askme131@yahoo.com]
> I have jsp page which displays fine when I access it directly
> from tomcat.
> But when the page is access through apache (mod_jk) it
> displays the source code.

Do you have a JkMount for the directory with the .jsp in *and* the same directory exposed directly through httpd?  Seems unlikely to be the problem givem that both responses shown below return a JSESSIONID cookie, but even so....

> This is happening only on Firefox and on IE it works fine.

What do the requests look like?  Presumably there's a key difference somewhere?

                - Peter

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