You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aleksey Tsalolikhin <at...@earthlink.net> on 2000/07/25 21:18:56 UTC

Apache getting confused by encoded jsessionid's (404 Not Found)

Hi.  We have some code that's generating a redirect, with the
jsessionid encoded in the URL if cookies are turned off.

    response.setStatus(response.SC_MOVED_TEMPORARILY);
    response.setHeader("Location", response.encodeRedirectURL("nextpage.jsp"));

The redirect is generated just fine, but Apache takes the
;jsessionid=XXX literally, as part of the file name, which results
in 404 Not Found:

[Tue Jul 25 11:49:22 2000] [error] [client 192.168.114.99] File does not
exist: /www/htdocs/beta3/nextpage.jsp;jsessionid=cphu2pu551

Is there something I need to do to Apache to have it pass these
requests to Tomcat, with the jsessionid?

Thanks in advance,
Aleksey.

SOAP

Posted by Jim Urban <ji...@netsteps.net>.
Has anyone used SOAP with a Servlet?  I'm talking about Simple Object Access
Protocol, not what you wash your face with.  A friend of mine has used the
PERL <gag> version, but I am doing Servlets and want to see how to use the
Java version.

Thanks,
Jim Urban
Project Manager
Netsteps Inc.


Re: Apache getting confused by encoded jsessionid's (404 Not Found)

Posted by Matt Goss <mg...@rtci.com>.
Thanks Craig,
Sorry about that Aleksey. Originally I thought you were hard coding the sessionID's in the URL, thus my mistake.
Matt

"Craig R. McClanahan" wrote:

> Matt Goss wrote:
>
> > Aleksey,
> > your problem is this:
> > ";jsessionid=XXX"
> > needs to be this:
> > "?jsessionid=XXX"
> > hope this helps,
> > Matt Goss
> >
>
> This advice is not correct.
>
> For servlet containers that conform to the servlet API version 2.2 (including
> Tomcat), the semicolon is the character required in the spec.  The session id
> is encoded as a *path* parameter, not a *query* parameter.
>
> In order to make this work with Apache, you will need to enable the
> MOD_REWRITE module to rewrite the URI in a fashion that Apache knows how to
> forward to Tomcat.  Detailed instructions for this (and answers for many other
> questions about Tomcat) can be found in the FAQ-O-MATIC at
> <http://jakarta.apache.org/faq/faqindex.html>.
>
> The detailed link to this particular answer is:
>
> http://jakarta.apache.org/jyve-faq/Turbine/screen/DisplayQuestionAnswer/action/SetAll/project_id/2/faq_id/12/topic_id/43/question_id/329
>
> (or search for "url rewriting" using the search engine).
>
> Craig McClanahan

Re: Apache getting confused by encoded jsessionid's (404 Not Found)

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Matt Goss wrote:

> Aleksey,
> your problem is this:
> ";jsessionid=XXX"
> needs to be this:
> "?jsessionid=XXX"
> hope this helps,
> Matt Goss
>

This advice is not correct.

For servlet containers that conform to the servlet API version 2.2 (including
Tomcat), the semicolon is the character required in the spec.  The session id
is encoded as a *path* parameter, not a *query* parameter.

In order to make this work with Apache, you will need to enable the
MOD_REWRITE module to rewrite the URI in a fashion that Apache knows how to
forward to Tomcat.  Detailed instructions for this (and answers for many other
questions about Tomcat) can be found in the FAQ-O-MATIC at
<http://jakarta.apache.org/faq/faqindex.html>.

The detailed link to this particular answer is:

http://jakarta.apache.org/jyve-faq/Turbine/screen/DisplayQuestionAnswer/action/SetAll/project_id/2/faq_id/12/topic_id/43/question_id/329

(or search for "url rewriting" using the search engine).

Craig McClanahan



Re: Apache getting confused by encoded jsessionid's (404 Not Found)

Posted by Matt Goss <mg...@rtci.com>.
Aleksey,
You may need to do an URL translation of some kind. I didn't realise
that the encodeRedirectURL() method was placing the ';' in the URL
instead of an '?' . This may be an error in the Tomcat code?!? Has
anyone else on the list noticed this, or found a fix for it?
Sorry I can be of more help.
Matt

Aleksey Tsalolikhin wrote:

>
> Dear Matt,
>
>         Thanks!  How do I accomplish that, please?  is there a way
> to tell encodeRedirectURL() to encode with '?' instead of ';'?
>
>         Or should I do a URL translation in Apache from
> ";jsessionid=" to "?jsessionid="?
>
> Yours truly,
> Aleksey.

Re: Apache getting confused by encoded jsessionid's (404 Not Found)

Posted by Aleksey Tsalolikhin <at...@earthlink.net>.
On Tue, Jul 25, 2000 at 03:46:42PM -0400, Matt Goss wrote:
> Aleksey,
> your problem is this:
> ";jsessionid=XXX"
> needs to be this:
> "?jsessionid=XXX"
> hope this helps,
> Matt Goss

Dear Matt,


	Thanks!  How do I accomplish that, please?  is there a way
to tell encodeRedirectURL() to encode with '?' instead of ';'?

	Or should I do a URL translation in Apache from
";jsessionid=" to "?jsessionid="?

Yours truly,
Aleksey.

Re: Apache getting confused by encoded jsessionid's (404 Not Found)

Posted by Matt Goss <mg...@rtci.com>.
Aleksey,
your problem is this:
";jsessionid=XXX"
needs to be this:
"?jsessionid=XXX"
hope this helps,
Matt Goss

Aleksey Tsalolikhin wrote:

> *snip*
> The redirect is generated just fine, but Apache takes the
> ;jsessionid=XXX literally, as part of the file name, which results
> in 404 Not Found:
>
> [Tue Jul 25 11:49:22 2000] [error] [client 192.168.114.99] File does not
> exist: /www/htdocs/beta3/nextpage.jsp;jsessionid=cphu2pu551
>
> Is there something I need to do to Apache to have it pass these
> requests to Tomcat, with the jsessionid?
>
> Thanks in advance,
> Aleksey.