You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Joe Pemberton <jo...@gmail.com> on 2007/01/30 02:17:49 UTC

Apache2, Tomcat5.5, mod_jk and HTTP content-type

I'm trying to connect Apache2 with mod_jk to Tomcat5.5.

Almost everything seems to work.  However, if I have cookies disabled,
Tomcat will rewrite all urls to include ;jsessionid=XXXXXXXXX (which is I
want and expect).  Unfortunately, it seems as though Apache2 insists on
determining the content-type of the response based on the extension of the
file requested.  This means that:

if i request "/myservlet/index.html"
  I get "Content-Type: text/html; charset=UTF-8"

if i request "/myservlet/index.html;jsessionid=12341243123412341234"
  I get "Content-Type: text/plain; charset=UTF-8"

Obviously, this is a problem.  I looked through the apache docs and the
mod_jk docs, but I didn't find a way to disable this behavior.  I could
possibly set the DefaultType directive to "text/html", but this would leave
.gif/.jpg/.css/etc broken.

 I also didn't find much through google.  Any pointers would be greatly
appreciated.

-Joe

Re: Apache2, Tomcat5.5, mod_jk and HTTP content-type

Posted by Joe Pemberton <jo...@gmail.com>.
Nevermind, I believe I found the issue.  My web application isn't
actually setting the content-type on any responses, so apache tries to
guess what the correct content-type is.

Sorry for the trouble,
-Joe

On 1/30/07, Rainer Jung <ra...@kippdata.de> wrote:
> Hi Joe,
>
> what is your configuration?
>
> 1) If Tomcat serves the request (i.e. mod_jk forwards it), the
> jsessionid should not be a problem, because tomcat should generate the
> Content-Type header.
>
> 2) If Apache serves the request, you should get a "Not Found", because
> it doesn't strip the jsessionid.
>
> So basically I don't understand your observation (although I didn't try
> by myself). If 2) is the problem, I'm actually thinking about an option
> to strip jsessionid's via mod_jk from static content.
>
> Regards,
>
> Rainer
>
> Joe Pemberton wrote:
> > I'm trying to connect Apache2 with mod_jk to Tomcat5.5.
> >
> > Almost everything seems to work.  However, if I have cookies disabled,
> > Tomcat will rewrite all urls to include ;jsessionid=XXXXXXXXX (which is I
> > want and expect).  Unfortunately, it seems as though Apache2 insists on
> > determining the content-type of the response based on the extension of the
> > file requested.  This means that:
> >
> > if i request "/myservlet/index.html"
> >  I get "Content-Type: text/html; charset=UTF-8"
> >
> > if i request "/myservlet/index.html;jsessionid=12341243123412341234"
> >  I get "Content-Type: text/plain; charset=UTF-8"
> >
> > Obviously, this is a problem.  I looked through the apache docs and the
> > mod_jk docs, but I didn't find a way to disable this behavior.  I could
> > possibly set the DefaultType directive to "text/html", but this would leave
> > .gif/.jpg/.css/etc broken.
> >
> > I also didn't find much through google.  Any pointers would be greatly
> > appreciated.
> >
> > -Joe
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: Apache2, Tomcat5.5, mod_jk and HTTP content-type

Posted by Rainer Jung <ra...@kippdata.de>.
Hi Joe,

what is your configuration?

1) If Tomcat serves the request (i.e. mod_jk forwards it), the 
jsessionid should not be a problem, because tomcat should generate the 
Content-Type header.

2) If Apache serves the request, you should get a "Not Found", because 
it doesn't strip the jsessionid.

So basically I don't understand your observation (although I didn't try 
by myself). If 2) is the problem, I'm actually thinking about an option 
to strip jsessionid's via mod_jk from static content.

Regards,

Rainer

Joe Pemberton wrote:
> I'm trying to connect Apache2 with mod_jk to Tomcat5.5.
> 
> Almost everything seems to work.  However, if I have cookies disabled,
> Tomcat will rewrite all urls to include ;jsessionid=XXXXXXXXX (which is I
> want and expect).  Unfortunately, it seems as though Apache2 insists on
> determining the content-type of the response based on the extension of the
> file requested.  This means that:
> 
> if i request "/myservlet/index.html"
>  I get "Content-Type: text/html; charset=UTF-8"
> 
> if i request "/myservlet/index.html;jsessionid=12341243123412341234"
>  I get "Content-Type: text/plain; charset=UTF-8"
> 
> Obviously, this is a problem.  I looked through the apache docs and the
> mod_jk docs, but I didn't find a way to disable this behavior.  I could
> possibly set the DefaultType directive to "text/html", but this would leave
> .gif/.jpg/.css/etc broken.
> 
> I also didn't find much through google.  Any pointers would be greatly
> appreciated.
> 
> -Joe

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