You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Robert B. Easter" <re...@comptechnews.com> on 2002/02/14 17:02:57 UTC

HTTP response header problems with Tomcat 4.0.2

Since I upgraded to Tomcat 4.0.2, I've noticed that HTTP response headers are 
different than they were in 4.0.1. The difference is causing various HTML 
pages from Tomcat, like 404 error messages and others, to display as plain 
text rather than rendering as HTML pages (I see HTML tags) in most web 
browsers: Netscape 6.2.1, Konqueror in KDE 2.2.2, and Lynx 2.8.1. However, 
Internet Exploror 6.0 displayed the pages as HTML still.

My requests to Tomcat are all going through Apache 1.3.23 with mod_webapp's 
Service. I don't even have the Tomcat standalone Service in my server.xml 
file. All my Hosts are inside the mod_webapp Service and work fine. My JSP 
and servlet contexts work and are configured with Apache WebAppDeploy lines. 
Just Tomcat error pages display wrong.

For example, here are a couple of requests to Tomcat 4.0.2 that display as 
plain text instead of HTML like they do in 4.0.1:

---------- example 1 (Tomcat 4.0.2: 404 response page) ---------------------
$ telnet comptechserv.com 80
Trying 66.12.175.114...
Connected to comptechserv.com.
Escape character is '^]'.
GET /SimpleServlet/S HTTP/1.1
Host: www.comptechserv.com

HTTP/1.1 404 Not Found
Date: Thu, 14 Feb 2002 15:02:52 GMT
Server: Apache/1.3.23 (Unix) PHP/4.1.1 mod_ssl/2.8.6 OpenSSL/0.9.6c
Transfer-Encoding: chunked
Content-Type: text/plain

243
<html><head><title>Apache Tomcat/4.0.2 - Error 
report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : 
white;background-color : #0086b2;} BODY{font-family : 
sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : 
white;background-color : #0086b2;} HR{color : #0086b2;} --></STYLE> 
</head><body><h1>Apache Tomcat/4.0.2 - HTTP Status 404 - /S</h1><HR size="1" 
noshade><p><b>type</b> Status report</p><p><b>message</b> 
<u>/S</u></p><p><b>description</b> <u>The requested resource (/S) is not 
available.</u></p><HR size="1" noshade></body></html>
0

Connection closed by foreign host.
--------------------------------------------------------------
Notice that the Content-Type is text/plain! Clearly, it should be text/html. 
In Netscape, Lynx, and Konqueror, this displays as plain text as it should 
since the content-type is set as text/plain. Interestingly, it displays as an 
HTML page in Microsoft Internet Explorer 6.0, which seems incorrect. The 
/SimpleServlet/ context is configured automatically from a web application 
archive (SimpleServlet.war) and has a WebAppDeploy entry in the Apache 
VirtualHost record for the www.comptechserv.com host. It has a test servlet 
mapped to /SimpleServlet/SimpleServlet.


--------- example 2 (Tomcat 4.0.2: 401 page)-------------------------
$ telnet comptechserv.com 80
Trying 66.12.175.114...
Connected to comptechserv.com.
Escape character is '^]'.
GET /manager/list HTTP/1.1
Host: www.comptechserv.com

HTTP/1.1 401 Authorization Required
Date: Thu, 14 Feb 2002 15:04:11 GMT
Server: Apache/1.3.23 (Unix) PHP/4.1.1 mod_ssl/2.8.6 OpenSSL/0.9.6c
Content-Type: text/html
Pragma: No-cache
Cache-Control: no-cache
WWW-Authenticate: Basic realm="Tomcat Manager Application"
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Transfer-Encoding: chunked

263
<html><head><title>Apache Tomcat/4.0.2 - Error 
report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : 
white;background-color : #0086b2;} BODY{font-family : 
sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : 
white;background-color : #0086b2;} HR{color : #0086b2;} --></STYLE> 
</head><body><h1>Apache Tomcat/4.0.2 - HTTP Status 401 - Unauthorized</h1><HR 
size="1" noshade><p><b>type</b> Status report</p><p><b>message</b> 
<u>Unauthorized</u></p><p><b>description</b> <u>This request requires HTTP 
authentication (Unauthorized).</u></p><HR size="1" noshade></body></html>
0

Connection closed by foreign host.
------------------------------------------------------------------------
This page sets the Content-type to text/html, but it still somehow ends up 
displaying as plain text in Netscape, Lynx, and Konqueror. Internet Explorer 
displays it as HTML as should be expected. The Pragma and Cache-Control 
headers do not appear with Tomcat 4.0.1. Perhaps these additional headers are 
causing a problem.



The next two examples are accessing the same two pages with Tomcat 4.0.1 with 
all configuration the same otherwise.

------------- example 3 (Tomcat 4.0.1: 404 page)---------------------
$ telnet www.comptechserv.com 80
Trying 66.12.175.114...
Connected to www.comptechserv.com.
Escape character is '^]'.
GET /SimpleServlet/S HTTP/1.1
Host: www.comptechserv.com

HTTP/1.1 404 Not Found
Date: Thu, 14 Feb 2002 15:37:13 GMT
Server: Apache/1.3.23 (Unix) PHP/4.1.1 mod_ssl/2.8.6 OpenSSL/0.9.6c
Content-Type: text/html
Transfer-Encoding: chunked

243
<html><head><title>Apache Tomcat/4.0.1 - Error 
report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : 
white;background-color : #0086b2;} BODY{font-family : 
sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : 
white;background-color : #0086b2;} HR{color : #0086b2;} --></STYLE> 
</head><body><h1>Apache Tomcat/4.0.1 - HTTP Status 404 - /S</h1><HR size="1" 
noshade><p><b>type</b> Status report</p><p><b>message</b> 
<u>/S</u></p><p><b>description</b> <u>The requested resource (/S) is not 
available.</u></p><HR size="1" noshade></body></html>
0

Connection closed by foreign host.
---------------------------------------------------------------------
Tomcat 4.0.1 gets the Content-type right: text/html. This displays properly 
in all web browsers.



---------- example 4 (Tomcat 4.0.1: 401 page ) ---------------------

$ telnet www.comptechserv.com 80
Trying 66.12.175.114...
Connected to www.comptechserv.com.
Escape character is '^]'.
GET /manager/list HTTP/1.1
Host: www.comptechserv.com

HTTP/1.1 401 Authorization Required
Date: Thu, 14 Feb 2002 15:36:34 GMT
Server: Apache/1.3.23 (Unix) PHP/4.1.1 mod_ssl/2.8.6 OpenSSL/0.9.6c
Content-Type: text/html
WWW-Authenticate: Basic realm="Tomcat Manager Application"
Transfer-Encoding: chunked
X-Pad: avoid browser bug

263
<html><head><title>Apache Tomcat/4.0.1 - Error 
report</title><STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : 
white;background-color : #0086b2;} BODY{font-family : 
sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : 
white;background-color : #0086b2;} HR{color : #0086b2;} --></STYLE> 
</head><body><h1>Apache Tomcat/4.0.1 - HTTP Status 401 - Unauthorized</h1><HR 
size="1" noshade><p><b>type</b> Status report</p><p><b>message</b> 
<u>Unauthorized</u></p><p><b>description</b> <u>This request requires HTTP 
authentication (Unauthorized).</u></p><HR size="1" noshade></body></html>
0

Connection closed by foreign host.
---------------------------------------------------------------------
This differs from Tomcat 4.0.2 in that it includes an X-Pad: header. I'm not 
exactly sure what it does, but this page displays properly in all browsers. 
Tomcat 4.0.1 also does not include the Pragma and Cache-Control headers that 
4.0.2 did.

If anyone can explain why I'm having this problem please reply. Thanks.

Robert B. Easter

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: HTTP response header problems with Tomcat 4.0.2

Posted by Remy Maucherat <re...@apache.org>.
> Since I upgraded to Tomcat 4.0.2, I've noticed that HTTP response headers
are
> different than they were in 4.0.1. The difference is causing various HTML
> pages from Tomcat, like 404 error messages and others, to display as plain
> text rather than rendering as HTML pages (I see HTML tags) in most web
> browsers: Netscape 6.2.1, Konqueror in KDE 2.2.2, and Lynx 2.8.1. However,
> Internet Exploror 6.0 displayed the pages as HTML still.

Mozilla 0.9.8 on Windows works fine, so I didn't notice the issue :-(
It is fixed now.

Remy


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>