You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul Carver <pa...@carverclan.com> on 2001/12/01 18:13:23 UTC

jsessionid in URL causes Apache/Tomcat to product 404 error

I've read a lot of messages regarding this problem, but still can't figure 
out the solution (so you might want to read everything here before 
replying).  I'm using Windows2000 Server on an Apache virtual host running 
Tomcat (more  platform info below).

I'm tracking sessions in my jsp pages.  I need to accept browers who do not 
have cookies enabled.  I redirect to a page using 
response.encodeRedirectURL(...).  This creates a URL, 
http://domain.com/alias/thepage;jsessionid=xxx?myparm=yyy.  I always 
receive a 404 error and at the same time see tomcat message in the console:

Ctx( 192.168.0.41:/java-mfc ): 404 R( /java-mfc + 
/jsp/gmain.jsp;jsessionid=bb7p455ro1 + null) null

Everything works fine if cookies are enabled (i.e. without the jsessionid 
in the URL, things are great).  If anyone has any ideas, I would love to 
hear it.

Below are more tidbits of information.
==============
This problem only occurs when cookies are disabled.
I'm using the Apache <Virtual Host/>.
I'm using the Tomcat <Host/> (rather just a <Context/>).
==============
Platform:
Windows2000 Server
Apache 1.3.22
Tomcat 3.2.4
Sun's Java SDK 1.3.1
==============
When not using sessions, or sessions without cookies...
all my jsp invocations work fine
all my servlets can be called fine
bottom line...everything works great except with a jsessionid is within the url
==============
I've read several archive message indicating that this can be solved by 
making sure mod_rewrite is enabled with the rule; I've done this, but it 
still doesn't work (remember, this is inside a virtual host in Apache's 
configuration).
    <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteRule ^(/.*;jsessionid=.*)$ $1 [T=jserv-servlet]
    </IfModule>
Of course the Apache configuration has the Load/Add module for mod_rewrite 
stuff.
==============
All my Apache and Tomcat paths use "progra~1" rather than "Program Files".
==============
My mod_rewrite debug looks like:
(2) init rewrite engine with requested uri 
/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1
(3) applying pattern '^(/.*;jsessionid=.*)$' to uri 
'/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1'
(2) rewrite /java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1 -> 
/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1
(2) remember /java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1 to have 
MIME-type 'jserv-servlet'
(2) local path result: /java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1
(2) prefixed with document_root to 
d:/data/apache/www/html/mathfactcafe/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1
(1) go-ahead with 
d:/data/apache/www/html/mathfactcafe/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1 
[OK]
(1) force filename d:/data/apache/www/html/mathfactcafe/java-mfc to have 
MIME-type 'jserv-servlet'
==============

Paul


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


Re: jsessionid in URL causes Apache/Tomcat to product 404 error

Posted by Paul Carver <pa...@carverclan.com>.
Ok, I've got a bit more info here...after looking pretty darn close at the 
mod_rewrite log output, the line;

(2) prefixed with document_root to 
d:/data/apache/www/html/mathfactcafe/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1

It appears that the path prefixed was to my web directory...not my tomcat 
jsp directory; I guess that's why I get a 404 page not found error.  I 
played around with this stuff a bit more.  It appears that if I do a 
<jsp:forward/> to a link with a jsessionid, everything works ok.  But, 
anything that goes directly to the web server (e.g. an HREF) with a 
jsessionid in it still gets a 404 page not found error.

Why is mod_rewrite putting the doc root on it?  Since only URLs with a 
jsessionid in it are bound for my tomcat jsp directory, should I write a 
new rule to create a new path to the tomcat jsp root?  Just seems like 
something must be configured wrong since the url's work fine without the 
jsessionid...but then they are not going through mod_rewrite and getting 
the web directory prefixed on them rather than the tomcat jsp directory.

:-(

/paul

At 10:13 AM 12/1/2001 -0700, Paul Carver wrote:
>I've read a lot of messages regarding this problem, but still can't figure 
>out the solution (so you might want to read everything here before 
>replying).  I'm using Windows2000 Server on an Apache virtual host running 
>Tomcat (more  platform info below).
>
>I'm tracking sessions in my jsp pages.  I need to accept browers who do 
>not have cookies enabled.  I redirect to a page using 
>response.encodeRedirectURL(...).  This creates a URL, 
>http://domain.com/alias/thepage;jsessionid=xxx?myparm=yyy.  I always 
>receive a 404 error and at the same time see tomcat message in the console:
>
>Ctx( 192.168.0.41:/java-mfc ): 404 R( /java-mfc + 
>/jsp/gmain.jsp;jsessionid=bb7p455ro1 + null) null
>
>Everything works fine if cookies are enabled (i.e. without the jsessionid 
>in the URL, things are great).  If anyone has any ideas, I would love to 
>hear it.
>
>Below are more tidbits of information.
>==============
>This problem only occurs when cookies are disabled.
>I'm using the Apache <Virtual Host/>.
>I'm using the Tomcat <Host/> (rather just a <Context/>).
>==============
>Platform:
>Windows2000 Server
>Apache 1.3.22
>Tomcat 3.2.4
>Sun's Java SDK 1.3.1
>==============
>When not using sessions, or sessions without cookies...
>all my jsp invocations work fine
>all my servlets can be called fine
>bottom line...everything works great except with a jsessionid is within 
>the url
>==============
>I've read several archive message indicating that this can be solved by 
>making sure mod_rewrite is enabled with the rule; I've done this, but it 
>still doesn't work (remember, this is inside a virtual host in Apache's 
>configuration).
>    <IfModule mod_rewrite.c>
>       RewriteEngine on
>       RewriteRule ^(/.*;jsessionid=.*)$ $1 [T=jserv-servlet]
>    </IfModule>
>Of course the Apache configuration has the Load/Add module for mod_rewrite 
>stuff.
>==============
>All my Apache and Tomcat paths use "progra~1" rather than "Program Files".
>==============
>My mod_rewrite debug looks like:
>(2) init rewrite engine with requested uri 
>/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1
>(3) applying pattern '^(/.*;jsessionid=.*)$' to uri 
>'/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1'
>(2) rewrite /java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1 -> 
>/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1
>(2) remember /java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1 to have 
>MIME-type 'jserv-servlet'
>(2) local path result: /java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1
>(2) prefixed with document_root to 
>d:/data/apache/www/html/mathfactcafe/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1
>(1) go-ahead with 
>d:/data/apache/www/html/mathfactcafe/java-mfc/jsp/gmain.jsp;jsessionid=rmoxmq6gj1 
>[OK]
>(1) force filename d:/data/apache/www/html/mathfactcafe/java-mfc to have 
>MIME-type 'jserv-servlet'
>==============
>
>Paul
>
>
>--
>To unsubscribe:   <ma...@jakarta.apache.org>
>For additional commands: <ma...@jakarta.apache.org>
>Troubles with the list: <ma...@jakarta.apache.org>
>


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