You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Loïc Lefèvre <ll...@fivia.com> on 2001/08/03 13:06:03 UTC

Where are my cookies?

Hi,
It's me again!!!!
I've always my problem with sessions but I've got clue:

Last episod:

I've got an application and I must first loggin.
When the application receive the request (user+password)
it creates a session storing user and password parameters
then call:

        respons.sendRedirect("/start/adfront.html");

When the application receive this new request
(I want the page "/start/adfront.html"), the application
first check in the session the presence of user and password parameters...
For that, it calls:

        HttpSession session = request.getSession(false); <-- to not recreate
the session, IT MUST EXIST!

And as you guess : I T   D O E S N ' T   W O R K ! :((((((((((

Today:
             Loïc Lefèvre in

         THE FIGHT FOR MIGRATION
             JServ -> Tomcat

           episod: COOKIES are gone!

            Apache 1.3.12
          as the http server

                 and

             Tomcat 3.2.3
          as the Servlet Engine

             ...starring mod_jk 1.24


Well after this little introduction, I have some clues:

Here is what happend:
I save the following HTTP packets

------------------- Apache JServ ---------------------

Apache JServ response to my 1st request (I mean login):

#...
# |
#[-]- HTTP: Reply (HTTP/1.1 302 Found) ... [683]
# |   |
# |  [+]- HTTP: Status Line = HTTP/1.1  302 Found ... [20]
# |  [-]- HTTP: Header Fields ... [382]
# |   |    |
# |   |  [+]- HTTP: General-Header : Date = Thu, 02 Aug 2001 13:53:25 GMT
... [37]
# |   |  [+]- HTTP: Response-Header: Server = Apache/1.3.12 (Unix)  (Red
Hat/Linux) mod_ssl/2.6.6 OpenSSL/0.9.5a mod_perl/1.24 ApacheJServ/1.1.2 ...
[108]
# |   |  [+]- HTTP: General-Header : Cache-Control = no-store ... [25]
# |   |  [+]- HTTP: Entity-Header  : Set-Cookie =
JServSessionIdbom=nyghyw0mi1; path=/ ... [50]
# |   |  [+]- HTTP: Response-Header: Location = /start/adfront.html ... [31]
# |   |  [+]- HTTP: Entity-Header  : Keep-Alive = timeout=15, max=99 ...
[32]
# |   |  [+]- HTTP: General-Header : Connection = Keep-Alive ... [24]
# |   |  [+]- HTTP: General-Header : Transfer-Encoding = chunked ... [28]
# |   |  [+]- HTTP: Entity-Header  : Content-Type = text/html;
charset=iso-8859-1 ... [47]
#...

There is a cookie!

Apache JServ redirection:

#...
#[-]- HTTP: Header Fields ... [444]
# |    |
# |  [+]- HTTP: Entity-Header : Accept = application/vnd.ms-excel,
image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-powerpoint, application/msword, */* ... [143]
# |  [+]- HTTP: Entity-Header : Referer =
http://bom.fivia.com/start/log.html ... [46]
# |  [+]- HTTP: Entity-Header : Accept-Language = fr ... [21]
# |  [+]- HTTP: Entity-Header : Content-Type =
application/x-www-form-urlencoded ... [49]
# |  [+]- HTTP: Entity-Header : Accept-Encoding = gzip, deflate ... [32]
# |  [+]- HTTP: Entity-Header : User-Agent = Mozilla/4.0 (compatible; MSIE
5.0; Windows NT ; DigExt) ... [58]
# |  [+]- HTTP: Entity-Header : Host = bom.fivia.com ... [21]
# |  [+]- HTTP: Entity-Header : Cookie = JServSessionIdbom=nyghyw0mi1 ...
[38]
# |  [+]- HTTP: General-Header: Connection = Keep-Alive ... [26]
#...

The cookie is sent back to the server!

--------- TOMCAT -------------------

Tomcat/mod_jk response to my 1st request:

#...
#[-]- HTTP: Header Fields ... [552]
# |    |
# |  [+]- HTTP: General-Header : Date = Thu, 02 Aug 2001 14:02:46 GMT ...
[37]
# |  [+]- HTTP: Response-Header: Server = Apache/1.3.12 (Unix)  (Red
Hat/Linux) mod_ssl/2.6.6 OpenSSL/0.9.5a mod_perl/1.24 mod_jk ... [90]
# |  [+]- HTTP: General-Header : Cache-Control = no-store ... [25]
# |  [+]- HTTP: Response-Header: Location =
http://lol.fivia.com/start/adfront.html ... [51]
# |  [+]- HTTP: Entity-Header  : Content-Length = 178 ... [21]
# |  [+]- HTTP: Entity-Header  : Set-Cookie2 = JSESSIONID=cm9vb30ub1
;Version=1 ;Discard;Path="/lol" ... [66]
# |  [+]- HTTP: Entity-Header  : Set-Cookie = JSESSIONID=cm9vb30ub1
;Path="/lol" ... [45]
# |  [+]- HTTP: Entity-Header  : Servlet-Engine = Tomcat Web Server/3.2.3
(JSP 1.1 ; Servlet 2.2; Java 1.3.0; Linux 2.2.16-22 x86; java.vendor=IBM
Corporation ... [126]
# |  [+]- HTTP: Entity-Header  : Keep-Alive = timeout=15, max=100 ... [33]
# |  [+]- HTTP: General-Header : Connection = Keep-Alive ... [24]
# |  [+]- HTTP: Entity-Header  : Content-Type = text/html ... [14]
#...

My browser receive 2 cookies

Tomcat/mod_jk redirection:

#...
#[-]- HTTP: Header Fields ... [406]
# |    |
# |  [+]- HTTP: Entity-Header : Accept = application/vnd.ms-excel,
image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-powerpoint, application/msword, */* ... [143]
# |  [+]- HTTP: Entity-Header : Accept-Language = fr ... [21]
# |  [+]- HTTP: Entity-Header : Content-Type =
application/x-www-form-urlencoded ... [49]
# |  [+]- HTTP: Entity-Header : Accept-Encoding = gzip, deflate ... [32]
# |  [+]- HTTP: Entity-Header : User-Agent = Mozilla/4.0 (compatible; MSIE
5.0; Windows NT ; DigExt) ... [58]
# |  [+]- HTTP: Entity-Header : Host = lol.fivia.com ... [21]
# |  [+]- HTTP: General-Header: Connection = Keep-Alive ... [24]
# |  [+]- HTTP: Entity-Header : Referer =
http://lol.fivia.com/start/log.html ... [46]
#...

And as you can see, cookies are not send back to the server thus I can't
access
my old session.

Any idea? remark? question? to help me... PLEASE

Loïc Lefèvre