Quantcast

Session lost when switching from https to http after upgrade to Tomcat 6

classic Classic list List threaded Threaded
30 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Session lost when switching from https to http after upgrade to Tomcat 6

krusek
I have Apache 2 with SSL,  mod_jk connection, and Tomcat.  Everything has worked peachy from one tomcat upgrade after another.  However now I upgraded to tomcat 6 and I am loosing the session when switching from https to http within the same domain.

For clarity,  Apache 2 is handling SSL not tomcat.  

Does anyone know why this is happening?

Thanks!

Kevin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Bill Davidson-5
krusek wrote:
> I have Apache 2 with SSL,  mod_jk connection, and Tomcat.  Everything has
> worked peachy from one tomcat upgrade after another.  However now I upgraded
> to tomcat 6 and I am loosing the session when switching from https to http
> within the same domain.
>
> For clarity,  Apache 2 is handling SSL not tomcat.  
>
> Does anyone know why this is happening?
>  
I appear to be having the exact same problem.  If I figure it out, I'll
reply
here.  Likewise, please let us know if you figure it out.




---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Rainer Jung-3
In reply to this post by krusek
krusek wrote:
> I have Apache 2 with SSL,  mod_jk connection, and Tomcat.  Everything has
> worked peachy from one tomcat upgrade after another.  However now I upgraded
> to tomcat 6 and I am loosing the session when switching from https to http
> within the same domain.
>
> For clarity,  Apache 2 is handling SSL not tomcat.  
>
> Does anyone know why this is happening?

Are you using cookies for the sessions (JSESSIONID cookie) or URL
encoding (";jsessionid=")?

Is some cookie flagged as being "secure"?
You can check how the cookie looks like e.g. using Firefox (Preferences
- Privacy - Cookies).

> Thanks!
>
> Kevin

Regards,

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

krusek
We use tomcat forms authentication and it is cookies being used.

There are 3 cookies,  JSESSONIDSSO, test and JSESSONID.
Not sure how you tell if its marked secure?   The test cookie is for testing to assure cookies are enabled.

Thanks for your help!

 

Rainer Jung-3 wrote
krusek wrote:
> I have Apache 2 with SSL,  mod_jk connection, and Tomcat.  Everything has
> worked peachy from one tomcat upgrade after another.  However now I upgraded
> to tomcat 6 and I am loosing the session when switching from https to http
> within the same domain.
>
> For clarity,  Apache 2 is handling SSL not tomcat.  
>
> Does anyone know why this is happening?

Are you using cookies for the sessions (JSESSIONID cookie) or URL
encoding (";jsessionid=")?

Is some cookie flagged as being "secure"?
You can check how the cookie looks like e.g. using Firefox (Preferences
- Privacy - Cookies).

> Thanks!
>
> Kevin

Regards,

Rainer

---------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

André Warnier
Hi.

A couple of emails ago, I think you showed the code that was doing a
redirect, and said that that was where it seemed to be "losing the cookie".

Let me get back to a couple of my oen emails ago, just to set matters
straight : a cookie is "a browser thing".  If the browser has never seen
the cookie, it can never send it back on a subsequent request, right ?
I wonder if the re-direct you are doing, from the HTTPS to the HTTP
server, would not by any chance be some kind of purely internal
redirect, without going to the browser at all.
So that the HTTPS part "thinks" it is setting a cookie, but in fact the
browser never gets that response, so the browser never gets the cookie.
That may be hidden somewhere in the code that is being called to do the
redirect, and which under earlier versions may have done an external
redirect (with a back-and-forth through the browser), but which now has
become purely internal.
A lot of speculation here, but who knows ?

Now, I know I am being a pain, but you have a puzzling problem, and
sometimes it is the obvious things that one does not see.

So let me again insist : a cookie is a browser thing.
If you open your browser and navigate to a server, and at some point
this server sends back a response with a cookie, the browser will
*always* send back that cookie on any subsequent request to the same
server, unless :
- the browser is set to ignore cookies
- it never received the cookie in the first place
- the user manually (or programmatically) deletes the cookie from the
browser cookie store.
- you close the browser, and the cookie was "for the session only".
The next time you open the browser, the cookie is gone then.
- the cookie expires (expiration date/time is past)
- the cookie has been re-sent in the meantime by the server, with a
date/time such that it has expired (that's the same as the previous
case, except that here it is the server that decided at some point to
"expire" the cookie, by updating it)
- the cookie is marked "secure" (HTTPS-only), and you are not (or no
longer) on an HTTPS connection.

To my knowledge, there exists no case where the browser would not send a
cookie with every request, if it has it and it is valid.
(So for instance, make sure that the code which is setting the cookie,
has not changed so that now it is still setting a cookie, but one that
is immediately expired.)

And one more :
When a server sends a cookie to a browser, it happens by means of a HTTP
header in a response to the browser. This HTTP header is
"Set-Cookie:(cookie value)"
When a browser sends a cookie to a server, it happens by means of a HTTP
header joined to a request.  The header then is
"Cookie: (cookie-value)".
So, if by some circumstance that I cannot really fathom, the server
would compose a response with a cookie, it would do it by adding a HTTP
header "Set-Cookie".  If that response would be short-circuited and go
back right into the server, the input side of the server would not see
this cookie, because it does not arrive in a "Cookie" header.

André



krusek wrote:

> We use tomcat forms authentication and it is cookies being used.
>
> There are 3 cookies,  JSESSONIDSSO, test and JSESSONID.
> Not sure how you tell if its marked secure?   The test cookie is for testing
> to assure cookies are enabled.
>
> Thanks for your help!
>
>  
>
>
> Rainer Jung-3 wrote:
>> krusek wrote:
>>> I have Apache 2 with SSL,  mod_jk connection, and Tomcat.  Everything has
>>> worked peachy from one tomcat upgrade after another.  However now I
>>> upgraded
>>> to tomcat 6 and I am loosing the session when switching from https to
>>> http
>>> within the same domain.
>>>
>>> For clarity,  Apache 2 is handling SSL not tomcat.  
>>>
>>> Does anyone know why this is happening?
>> Are you using cookies for the sessions (JSESSIONID cookie) or URL
>> encoding (";jsessionid=")?
>>
>> Is some cookie flagged as being "secure"?
>> You can check how the cookie looks like e.g. using Firefox (Preferences
>> - Privacy - Cookies).
>>
>>> Thanks!
>>>
>>> Kevin
>> Regards,
>>
>> Rainer
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: [hidden email]
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

markt

André Warnier wrote:
> A lot of speculation here, but who knows ?
Indeed. And it is all wrong.

> To my knowledge, there exists no case where the browser would not send a
> cookie with every request, if it has it and it is valid.
Well, there is the obvious example Rainer has already given of cookies
marked as secure. Given that the session is created under https this is
probably what is happening. Sessions are not maintained in transitions from
https to http.

If you need to protect the session creation with https then you should
almost certainly be providing the same level of protection for the session ID.

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Len Popp
In reply to this post by krusek
On Fri, Jun 6, 2008 at 15:11, krusek <[hidden email]> wrote:
> There are 3 cookies,  JSESSONIDSSO, test and JSESSONID.
> Not sure how you tell if its marked secure?

Some browsers can tell you this. Check your browser's documentation.

But what I don't understand is why it "worked" before - I thought that
session cookies were *supposed* to be dropped when going from HTTPS to
HTTP.
Ref: http://marc.info/?l=tomcat-user&m=112370795230194&w=2
--
Len

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

André Warnier
In reply to this post by markt


Mark Thomas wrote:
>
> André Warnier wrote:
>> A lot of speculation here, but who knows ?
> Indeed. And it is all wrong.
Is that proven, or mere speculation on your part ?

>
>> To my knowledge, there exists no case where the browser would not send
>> a cookie with every request, if it has it and it is valid.
> Well, there is the obvious example Rainer has already given of cookies
> marked as secure.
Which I mentioned, as one of the cases where a browser would not send
the cookie.  But I don't think that a cookie sent by the browser over a
secure connection is necessarily marked as "secure".  That is a
attribute of the cookie, decided by the cookie creator.

Given that the session is created under https this is
> probably what is happening. Sessions are not maintained in transitions
> from https to http.
I think that you may err here.  Are you not confusing sessions and cookies ?
Is is really the session that is gone at the server side ?
Or is it that the session is still there, but the absence (in the
browser request) of the cookie containing the session-id does not allow
the server to reconnect the  request with the still-existing session ?
I thought that this last was the problem originally mentioned.

It must be easy to distinguish between these two cases at the server
side : either there is no cookie, or there is a cookie but the cookie-id
it contains does not allow to reconnect validly to an existing session.
Which is it ?

There is something else that tickles my memory : in a previous message,
krusek said : "For clarity,  Apache 2 is handling SSL not tomcat.  "
If so, does Tomcat even know that there is an SSL/HTTPS part ?
I mean, the connection between Apache and Tomcat via mod_jk, if they are
all on the same host, has no particular reason to be SSL, or is it ?
(that is ignorance on my part, I really don't know)

>
> If you need to protect the session creation with https then you should
> almost certainly be providing the same level of protection for the
> session ID.
Well, not necessarily.  I know you refer to a previous thread somewhere,
but I beg to differ.  You may be wanting to protect via HTTPS the
exchange of a user-id and password over the Internet.  But once that is
done, the session data on the server probably contains other elements,
sufficient to ensure that it is not someone else sending this same
session-id.
The application may be trivial, but not the user's password.

>
> Mark
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: [hidden email]
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

markt

André Warnier wrote:
> Mark Thomas wrote:
>> André Warnier wrote:
>>> A lot of speculation here, but who knows ?
>> Indeed. And it is all wrong.
> Is that proven, or mere speculation on your part ?
That is fact. In the cases where Tomcat does do an internal redirect it
uses a RequestDispatcher.forward()

>>> To my knowledge, there exists no case where the browser would not
>>> send a cookie with every request, if it has it and it is valid.
>> Well, there is the obvious example Rainer has already given of cookies
>> marked as secure.
> Which I mentioned, as one of the cases where a browser would not send
> the cookie.  But I don't think that a cookie sent by the browser over a
> secure connection is necessarily marked as "secure".  That is a
> attribute of the cookie, decided by the cookie creator.
The OP is asking about the session cookie which is created by Tomcat. When
the session is created under https, the cookie is marked as secure.

> Given that the session is created under https this is
>> probably what is happening. Sessions are not maintained in transitions
>> from https to http.
> I think that you may err here.  Are you not confusing sessions and
> cookies ?
This is just semantics. The cookie is secure. A secure cookie will not be
sent over http. From both the user's and the application's perspective the
session is lost.

> Is is really the session that is gone at the server side ?
No. It is still there. Switching back to https should restore the session.

> Or is it that the session is still there, but the absence (in the
> browser request) of the cookie containing the session-id does not allow
> the server to reconnect the  request with the still-existing session ?
> I thought that this last was the problem originally mentioned.
That sums it up pretty well.

> It must be easy to distinguish between these two cases at the server
> side : either there is no cookie, or there is a cookie but the cookie-id
> it contains does not allow to reconnect validly to an existing session.
> Which is it ?
It is the first. There is no cookie sent from the browser.

> There is something else that tickles my memory : in a previous message,
> krusek said : "For clarity,  Apache 2 is handling SSL not tomcat.  "
> If so, does Tomcat even know that there is an SSL/HTTPS part ?
Yes. mod_jk passes that info along. It will also pass on any client
certificates if httpd has been configured for certificate authentication.

> I mean, the connection between Apache and Tomcat via mod_jk, if they are
> all on the same host, has no particular reason to be SSL, or is it ?
The connection uses the AJP protocol. mod_jk doesn't support any form of
encryption for this link. There are ways of encrypting this if you need to.

>> If you need to protect the session creation with https then you should
>> almost certainly be providing the same level of protection for the
>> session ID.
> Well, not necessarily.  I know you refer to a previous thread somewhere,
> but I beg to differ.  You may be wanting to protect via HTTPS the
> exchange of a user-id and password over the Internet.  But once that is
> done, the session data on the server probably contains other elements,
> sufficient to ensure that it is not someone else sending this same
> session-id.
This could be implemented by the application but usually isn't. The most
often referred to solution uses the client IP as an added check. The
problem is that some clients (as a result of the ISP they are using) change
IP with every request.

> The application may be trivial, but not the user's password.
If the functionality is important enough to protect with a password over
SSL then the session ID, which for most applications will give access to
that functionality, should usually be protected in the same way. There will
be some exceptions to this. Protected the session by other means is one
possibility.

To get back to the OPs question. The behaviour seen is entirely expected.
Like Len, I am more concerned that it wasn't seen in previous versions.

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

André Warnier
Mark,
thank you for the explanations below.  And I apologise if I answered
rather testily before.

Mark Thomas wrote:

>
> André Warnier wrote:
>> Mark Thomas wrote:
>>> André Warnier wrote:
>>>> A lot of speculation here, but who knows ?
>>> Indeed. And it is all wrong.
>> Is that proven, or mere speculation on your part ?
> That is fact. In the cases where Tomcat does do an internal redirect it
> uses a RequestDispatcher.forward()
>
>>>> To my knowledge, there exists no case where the browser would not
>>>> send a cookie with every request, if it has it and it is valid.
>>> Well, there is the obvious example Rainer has already given of
>>> cookies marked as secure.
>> Which I mentioned, as one of the cases where a browser would not send
>> the cookie.  But I don't think that a cookie sent by the browser over
>> a secure connection is necessarily marked as "secure".  That is a
>> attribute of the cookie, decided by the cookie creator.
> The OP is asking about the session cookie which is created by Tomcat.
> When the session is created under https, the cookie is marked as secure.
>
>> Given that the session is created under https this is
>>> probably what is happening. Sessions are not maintained in
>>> transitions from https to http.
>> I think that you may err here.  Are you not confusing sessions and
>> cookies ?
> This is just semantics. The cookie is secure. A secure cookie will not
> be sent over http. From both the user's and the application's
> perspective the session is lost.
>
>> Is is really the session that is gone at the server side ?
> No. It is still there. Switching back to https should restore the session.
>
>> Or is it that the session is still there, but the absence (in the
>> browser request) of the cookie containing the session-id does not
>> allow the server to reconnect the  request with the still-existing
>> session ?
>> I thought that this last was the problem originally mentioned.
> That sums it up pretty well.
>
>> It must be easy to distinguish between these two cases at the server
>> side : either there is no cookie, or there is a cookie but the
>> cookie-id it contains does not allow to reconnect validly to an
>> existing session.
>> Which is it ?
> It is the first. There is no cookie sent from the browser.
>
>> There is something else that tickles my memory : in a previous
>> message, krusek said : "For clarity,  Apache 2 is handling SSL not
>> tomcat.  "
>> If so, does Tomcat even know that there is an SSL/HTTPS part ?
> Yes. mod_jk passes that info along. It will also pass on any client
> certificates if httpd has been configured for certificate authentication.
>
>> I mean, the connection between Apache and Tomcat via mod_jk, if they
>> are all on the same host, has no particular reason to be SSL, or is it ?
> The connection uses the AJP protocol. mod_jk doesn't support any form of
> encryption for this link. There are ways of encrypting this if you need to.
>
>>> If you need to protect the session creation with https then you
>>> should almost certainly be providing the same level of protection for
>>> the session ID.
>> Well, not necessarily.  I know you refer to a previous thread
>> somewhere, but I beg to differ.  You may be wanting to protect via
>> HTTPS the exchange of a user-id and password over the Internet.  But
>> once that is done, the session data on the server probably contains
>> other elements, sufficient to ensure that it is not someone else
>> sending this same session-id.
> This could be implemented by the application but usually isn't. The most
> often referred to solution uses the client IP as an added check. The
> problem is that some clients (as a result of the ISP they are using)
> change IP with every request.
Off-topic : Are you sure that can really happen ? I must admit that I
have never seen that behaviour before, and it seems to me that it would
create a host of other problems (such as breaking the underlying TCP
sessions).

>
>> The application may be trivial, but not the user's password.
> If the functionality is important enough to protect with a password over
> SSL then the session ID, which for most applications will give access to
> that functionality, should usually be protected in the same way. There
> will be some exceptions to this. Protected the session by other means is
> one possibility.
>
> To get back to the OPs question. The behaviour seen is entirely
> expected. Like Len, I am more concerned that it wasn't seen in previous
> versions.
>

Without meaning any disrespect to anyone, it is in my experience a
rather frequent occurrence that someone would say that "nothing else
than a xxx update was made, and the consequence is yyy", and
overlook/not think it important to mention, that something else was also
done simultaneously.  I have been guilty of the same sin.

Since according to Mark's explanation above, there is a rational
explanation of why the session-id-bearing cookies, although present in
the browser cache, are not being sent anymore after the session switches
back from HTTPS to HTTP, and since that behaviour is not new and has in
fact nothing to do with Tomcat directly, the logical inference is that
there must have been something else changed compared to before, when it
was working.

In other words, original submitter, out with it : what else apart from
the Tomcat update was done ?  Was the session pages layout, ever so
slightly, also modified maybe ?

André

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

markt

André Warnier wrote:
> Mark,
> thank you for the explanations below.  And I apologise if I answered
> rather testily before.
No problem. I can be a little short too sometimes.

>> The problem is that some clients (as a result of the ISP they are
>> using) change IP with every request.
> Off-topic : Are you sure that can really happen ? I must admit that I
> have never seen that behaviour before, and it seems to me that it would
> create a host of other problems (such as breaking the underlying TCP
> sessions).
I have never seen it but I do recall other people mentioning it as a
potential issue previously on this list. I just did a search of the
archives and found this thread:
http://markmail.org/message/db5mcsyn2yj5wt44

Mark

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

André Warnier


Mark Thomas wrote:
>
...

>>> The problem is that some clients (as a result of the ISP they are
>>> using) change IP with every request.
>> Off-topic : Are you sure that can really happen ? I must admit that I
>> have never seen that behaviour before, and it seems to me that it
>> would create a host of other problems (such as breaking the underlying
>> TCP sessions).
> I have never seen it but I do recall other people mentioning it as a
> potential issue previously on this list. I just did a search of the
> archives and found this thread:
> http://markmail.org/message/db5mcsyn2yj5wt44
>
Hmm.  I am not familiar with proxy details, but I guess they must also
change the "Keep-alive" ougoing packets, otherwise they would end up
triggering a lot of pending sessions at the destination servers level,
and that may make some people unhappy.
Good to know and store away anyway, if ever one is faced with such
behaviour.

André


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Bill Davidson-5
In reply to this post by André Warnier
I'm confused so I'm not sure what I say below makes sense.

If I'm reading these posts correctly, the cookie is issued by the front end
(which is Apache web server).  Since it is created on an https session, it
is being marked as "secure".  When browser switches to a non-secure
page on the same site, that cookie is not passed because it is a secure
cookie.

Apparently, this behavior changed between Apache 1.3.x+Apache SSL
and Apache 2.2 (mod_ssl) because my app used to work doing this with
Apache1.3 as the front end.

Is there some way to configure Apache not to mark the cookie as secure
even if it is creating it on an https connection?


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Johnny Kewl

----- Original Message -----
From: "Bill Davidson" <[hidden email]>
To: "Tomcat Users List" <[hidden email]>
Sent: Monday, June 09, 2008 12:36 AM
Subject: Re: Session lost when switching from https to http after upgrade to
Tomcat 6


> I'm confused so I'm not sure what I say below makes sense.
>
> If I'm reading these posts correctly, the cookie is issued by the front
> end
> (which is Apache web server).  Since it is created on an https session, it
> is being marked as "secure".  When browser switches to a non-secure
> page on the same site, that cookie is not passed because it is a secure
> cookie.
>
> Apparently, this behavior changed between Apache 1.3.x+Apache SSL
> and Apache 2.2 (mod_ssl) because my app used to work doing this with
> Apache1.3 as the front end.
>
> Is there some way to configure Apache not to mark the cookie as secure
> even if it is creating it on an https connection?

Bill... Just lose the FORM authentication, replace it with DIGEST, or even
BASIC.... I think all your problems will go away.

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Rainer Jung-3
In reply to this post by krusek
krusek schrieb:
> We use tomcat forms authentication and it is cookies being used.
>
> There are 3 cookies,  JSESSONIDSSO, test and JSESSONID.
> Not sure how you tell if its marked secure?   The test cookie is for testing
> to assure cookies are enabled.

As explained below, my Firefox tells me, for which connctions (secure or
all) it uses a cookie, when I look at the cookie in my preferences.

You can also use firebug with cleared cookies and have a look at the
Set-Cookie header (the header will contain a "; secure"), or you can
sniff your network traffic on the client side with wireshark, or on the
server side with tcpdump/snoop etc. for the same header. Remember that
you clear the cookies in the client/browser before looking for the
Set-Cookie header.

> Thanks for your help!

Regards,

Rainer

> Rainer Jung-3 wrote:
>> krusek wrote:
>>> I have Apache 2 with SSL,  mod_jk connection, and Tomcat.  Everything has
>>> worked peachy from one tomcat upgrade after another.  However now I
>>> upgraded
>>> to tomcat 6 and I am loosing the session when switching from https to
>>> http
>>> within the same domain.
>>>
>>> For clarity,  Apache 2 is handling SSL not tomcat.  
>>>
>>> Does anyone know why this is happening?
>> Are you using cookies for the sessions (JSESSIONID cookie) or URL
>> encoding (";jsessionid=")?
>>
>> Is some cookie flagged as being "secure"?
>> You can check how the cookie looks like e.g. using Firefox (Preferences
>> - Privacy - Cookies).
>>
>>> Thanks!
>>>
>>> Kevin
>> Regards,
>>
>> Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Bill Davidson-5
In reply to this post by Johnny Kewl
Johnny Kewl wrote:
> Bill... Just lose the FORM authentication, replace it with DIGEST, or
> even BASIC.... I think all your problems will go away.

I'm not exactly sure what you're saying.  Are you saying that I shouldn't be
authenticating through a form?



---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Bill Davidson-5
In reply to this post by Bill Davidson-5
Bill Davidson wrote:
> I'm confused so I'm not sure what I say below makes sense.
>
> If I'm reading these posts correctly, the cookie is issued by the
> front end
> (which is Apache web server).  Since it is created on an https
> session, it
> is being marked as "secure".  When browser switches to a non-secure
> page on the same site, that cookie is not passed because it is a secure
> cookie.
I was right about one thing: I was confused.

Apparently it was actually Tomcat creating the cookie.

I've found a usable workaround.  I'm having my login servlet create
and set the cookie (without setting it to secure).  That seems to have
made the problem go away.  I was trying to get away without changing
the app but this is a pretty minor change.


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Bill Davidson-5
BTW, I forgot to thank everyone for helping me to understand
what this problem better.  Understanding that the cookie was
being created by Tomcat with the secure flag and that the flag
was causing the problem was the key.

Thanks everyone.

--Bill Davidson


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Martin Gainty
If you're in a secure location that disallows cookies..you can always try
url-rewrite

Tomcat
http://tuckey.org/urlrewrite/

Caucho
http://www.caucho.com/resin/doc/rewrite-tags.xtp

Apache mod_rewrite
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

HTH
Martin
----- Original Message -----
From: "Bill Davidson" <[hidden email]>
To: "Tomcat Users List" <[hidden email]>
Sent: Monday, June 09, 2008 7:10 PM
Subject: Re: Session lost when switching from https to http after upgrade to
Tomcat 6


> BTW, I forgot to thank everyone for helping me to understand
> what this problem better.  Understanding that the cookie was
> being created by Tomcat with the secure flag and that the flag
> was causing the problem was the key.
>
> Thanks everyone.
>
> --Bill Davidson
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: [hidden email]
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Session lost when switching from https to http after upgrade to Tomcat 6

Bill Davidson-5
Martin wrote:
> If you're in a secure location that disallows cookies..you can always
> try url-rewrite

Sorry if I seem a bit dim but I don't understand how url-rewriting
helps me with cookie problems.



---------------------------------------------------------------------
To start a new topic, e-mail: [hidden email]
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12
Loading...