The variation between Content-Type: text/plain and Content-Type: text/ html is definitely your clue. The fact that it displays correctly when there is no Content-Type: header is simply evidence that browser make (reasonable) guesses.
You need to determine where this variation is coming from.
If your code is directly writing the servlet responses anywhere, you need to make sure that a setContentType("text/html") is executed.

On Apr 25, 2009, at 7:46 AM, David Rush wrote:

I'm having the same problem, where markup is sometimes appearing in the browser window instead of the rendered HTML.

I'm using my own server (MS Windows Server 2003), with Tomcat 6.0.18 behind a reverse proxy on Apache 2.2.11.

When I access one of my webapps via Tomcat's port (http://myserver:8080/Construction/ ) it works fine. When I access it via the reverse proxy (http://myserver/Construction ) using Firefox 3.0.9 I see the HTML markup displayed in the browser's window. When I access the webapp via IE either way, it works fine. Google Chrome produces the same results as Firefox.

Via Live HTTP Headers, when I access through the reverse proxy I see:

HTTP/1.x 200 OK
Date: Sat, 25 Apr 2009 11:39:11 GMT
Server: Apache-Coyote/1.1
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain

I suspect the "Content-Type: text/plain" is a clue. Straight to Tomcat I see:

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=53C3EC973BB365AAF92A1EC66F03271A; Path=/ Construction
Transfer-Encoding: chunked
Date: Sat, 25 Apr 2009 11:37:06 GMT

No "Content-Type" produced at all.

When I access it with Firefox via the Apache reverse proxy via the URL http://myserver/Construction/index.html (which is just mapped in web.xml to the controlling servlet, and my welcome-file is index.html), the webapp displays correctly, and the headers say:

HTTP/1.x 200 OK
Date: Sat, 25 Apr 2009 11:42:27 GMT
Server: Apache-Coyote/1.1
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html

I have 3 different webapps, but I only see the problem with one of them.

My reverse proxy configuration includes:

ProxyPass        /Construction http://localhost:8080/Construction
ProxyPassReverse /Construction http://localhost:8080/Construction

David

dfobox wrote:
I have JSP-based website running on my own server and I want to move it to hosting company. I've copied the files, they said they have enabled Tomcat for me, but browser shows source of the pages, even of those which don't have any script code inside - only properly formatted html. What could be a
problem? Thanks!

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


Reply via email to