You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Teter <mi...@gmail.com> on 2005/08/15 20:33:20 UTC

session problems: www.blahblah.com versus blahblah.com

Howdy.

I'm having some problems with sessions.

If my users come to "blahblah.com", then go away, then return, they
get a new session id (for www.blahblah.com).

But if they come to www.blahblah.com, leave, and return (via link from
external site), they keep the same session.

I finally discovered that the browser (Firefox in this case) ends up
with two different session cookies - one for www.blahblah.com and one
for blahblah.com.

What's the right thing to do to solve this?

Thanks much.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: session problems: www.blahblah.com versus blahblah.com

Posted by David Smith <dn...@cornell.edu>.
I would imagine the other way to do this is to implement a filter
looking for people trying to reach blahblah.com and returning a 302
redirect to www.blahblah.com.  That would give them all the proper
cookie from the start and could be implemented accross all your webapp
resources at once.

--David

Michael Teter wrote:

>I guess I was hoping there was some server-level redirect.
>
>I'm not sure how I would put the meta redirect in all my pages.  My
>app is a complicated mess (my fault - my lack of skill).
>
>The issue is that my users are clicking a PayPal "Subscribe" button,
>which sends them off to PayPal.  Part of the hidden information sent
>to PayPal when the user clicks that button is the return path.
>
>So if user comes to blahblah.com, clicks the Subscribe button it sends
>them to PayPal with a return path of www.blahblah.com (because that's
>what I'm telling PayPal to do.)  I'm thinking now I can just look at
>the URL they're at now and set my PayPal return path dynamically... If
>they're here as blahblah.com, I make sure to tell the PayPal form that
>the return path is blahblah.com.  If www, then return to www...
>
>Thanks for your suggestion though.  I can even continue using PayPal's
>encrypted buttons - I'll just make two buttons, one for www, and
>theother for just blahblah, and display the appropriate button based
>on current situation.
>
>Still, I think I was hoping that somewhere in server.xml I could say
>"all requests for blahblah.com should be mapped to www.blahblah.com."
>
>Thanks all.
>
>On 8/16/05, Peter Rossbach <pr...@objektpark.de> wrote:
>  
>
>>Hey Michael,
>>
>>I look inside the tomcat source and find that we don't set the cookie
>>hostname attribute.
>>That means that the calling client/browser must made the hostname
>>handling. I also
>>thing the redirect way is currently right direction.
>>
>>Peter
>>
>>Paul Singleton schrieb:
>>
>>    
>>
>>>Michael Teter wrote:
>>>
>>>      
>>>
>>>>If my users come to "blahblah.com", then go away, then return, they
>>>>get a new session id (for www.blahblah.com).
>>>>
>>>>But if they come to www.blahblah.com, leave, and return (via link from
>>>>external site), they keep the same session.
>>>>
>>>>I finally discovered that the browser (Firefox in this case) ends up
>>>>with two different session cookies - one for www.blahblah.com and one
>>>>for blahblah.com.
>>>>        
>>>>
>>>this behaviour seems reasonable to me...
>>>
>>>      
>>>
>>>>What's the right thing to do to solve this?
>>>>        
>>>>
>>>it doesn't need solving, just accepting :-)
>>>
>>>but assuming you want www.blahblah.com and blahblah.com
>>>to behave (session-wise) like one domain, which they aren't,
>>>you could redirect (client-side) from www.blahblah.com
>>>(which IMHO is the redundant/obsolete/legacy domain) to
>>>blahblah.com, which allocates sessions and dishes out cookies.
>>>
>>>i.e. www.blahblah.com is a static site which just serves e.g.
>>>
>>><html>
>>>  <head>
>>>    <title><%= a.appTitle %>: redirection page</title>
>>>    <meta http-equiv="refresh" content="0;url=http://blahblah.com" />
>>>  </head>
>>>  <body onLoad="window.location.replace('http://blahblah.com')">
>>>    <!-- optional "if you are not redirected..." blurb -->
>>>  </body>
>>><html>
>>>
>>>NB I haven't actually *tried* this :-)
>>>
>>>Paul Singleton
>>>
>>>
>>>      
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>  
>


-- 
=======================================
David Smith
Network Operations Supervisor
Department of Entomology
College of Agriculture & Life Sciences
Cornell University
2132 Comstock Hall
Ithaca, NY  14853
Phone: 607.255.9571
Fax: 607.255.0939


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: session problems: www.blahblah.com versus blahblah.com

Posted by Michael Teter <mi...@gmail.com>.
I guess I was hoping there was some server-level redirect.

I'm not sure how I would put the meta redirect in all my pages.  My
app is a complicated mess (my fault - my lack of skill).

The issue is that my users are clicking a PayPal "Subscribe" button,
which sends them off to PayPal.  Part of the hidden information sent
to PayPal when the user clicks that button is the return path.

So if user comes to blahblah.com, clicks the Subscribe button it sends
them to PayPal with a return path of www.blahblah.com (because that's
what I'm telling PayPal to do.)  I'm thinking now I can just look at
the URL they're at now and set my PayPal return path dynamically... If
they're here as blahblah.com, I make sure to tell the PayPal form that
the return path is blahblah.com.  If www, then return to www...

Thanks for your suggestion though.  I can even continue using PayPal's
encrypted buttons - I'll just make two buttons, one for www, and
theother for just blahblah, and display the appropriate button based
on current situation.

Still, I think I was hoping that somewhere in server.xml I could say
"all requests for blahblah.com should be mapped to www.blahblah.com."

Thanks all.

On 8/16/05, Peter Rossbach <pr...@objektpark.de> wrote:
> Hey Michael,
> 
> I look inside the tomcat source and find that we don't set the cookie
> hostname attribute.
> That means that the calling client/browser must made the hostname
> handling. I also
> thing the redirect way is currently right direction.
> 
> Peter
> 
> Paul Singleton schrieb:
> 
> > Michael Teter wrote:
> >
> >> If my users come to "blahblah.com", then go away, then return, they
> >> get a new session id (for www.blahblah.com).
> >>
> >> But if they come to www.blahblah.com, leave, and return (via link from
> >> external site), they keep the same session.
> >>
> >> I finally discovered that the browser (Firefox in this case) ends up
> >> with two different session cookies - one for www.blahblah.com and one
> >> for blahblah.com.
> >
> >
> > this behaviour seems reasonable to me...
> >
> >> What's the right thing to do to solve this?
> >
> >
> > it doesn't need solving, just accepting :-)
> >
> > but assuming you want www.blahblah.com and blahblah.com
> > to behave (session-wise) like one domain, which they aren't,
> > you could redirect (client-side) from www.blahblah.com
> > (which IMHO is the redundant/obsolete/legacy domain) to
> > blahblah.com, which allocates sessions and dishes out cookies.
> >
> > i.e. www.blahblah.com is a static site which just serves e.g.
> >
> > <html>
> >   <head>
> >     <title><%= a.appTitle %>: redirection page</title>
> >     <meta http-equiv="refresh" content="0;url=http://blahblah.com" />
> >   </head>
> >   <body onLoad="window.location.replace('http://blahblah.com')">
> >     <!-- optional "if you are not redirected..." blurb -->
> >   </body>
> > <html>
> >
> > NB I haven't actually *tried* this :-)
> >
> > Paul Singleton
> >
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: session problems: www.blahblah.com versus blahblah.com

Posted by Peter Rossbach <pr...@objektpark.de>.
Hey Michael,

I look inside the tomcat source and find that we don't set the cookie 
hostname attribute.
That means that the calling client/browser must made the hostname 
handling. I also
thing the redirect way is currently right direction.

Peter

Paul Singleton schrieb:

> Michael Teter wrote:
>
>> If my users come to "blahblah.com", then go away, then return, they
>> get a new session id (for www.blahblah.com).
>>
>> But if they come to www.blahblah.com, leave, and return (via link from
>> external site), they keep the same session.
>>
>> I finally discovered that the browser (Firefox in this case) ends up
>> with two different session cookies - one for www.blahblah.com and one
>> for blahblah.com.
>
>
> this behaviour seems reasonable to me...
>
>> What's the right thing to do to solve this?
>
>
> it doesn't need solving, just accepting :-)
>
> but assuming you want www.blahblah.com and blahblah.com
> to behave (session-wise) like one domain, which they aren't,
> you could redirect (client-side) from www.blahblah.com
> (which IMHO is the redundant/obsolete/legacy domain) to
> blahblah.com, which allocates sessions and dishes out cookies.
>
> i.e. www.blahblah.com is a static site which just serves e.g.
>
> <html>
>   <head>
>     <title><%= a.appTitle %>: redirection page</title>
>     <meta http-equiv="refresh" content="0;url=http://blahblah.com" />
>   </head>
>   <body onLoad="window.location.replace('http://blahblah.com')">
>     <!-- optional "if you are not redirected..." blurb -->
>   </body>
> <html>
>
> NB I haven't actually *tried* this :-)
>
> Paul Singleton
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: session problems: www.blahblah.com versus blahblah.com

Posted by Paul Singleton <pa...@jbgb.com>.
Michael Teter wrote:

> If my users come to "blahblah.com", then go away, then return, they
> get a new session id (for www.blahblah.com).
> 
> But if they come to www.blahblah.com, leave, and return (via link from
> external site), they keep the same session.
> 
> I finally discovered that the browser (Firefox in this case) ends up
> with two different session cookies - one for www.blahblah.com and one
> for blahblah.com.

this behaviour seems reasonable to me...

> What's the right thing to do to solve this?

it doesn't need solving, just accepting :-)

but assuming you want www.blahblah.com and blahblah.com
to behave (session-wise) like one domain, which they aren't,
you could redirect (client-side) from www.blahblah.com
(which IMHO is the redundant/obsolete/legacy domain) to
blahblah.com, which allocates sessions and dishes out cookies.

i.e. www.blahblah.com is a static site which just serves e.g.

<html>
   <head>
     <title><%= a.appTitle %>: redirection page</title>
     <meta http-equiv="refresh" content="0;url=http://blahblah.com" />
   </head>
   <body onLoad="window.location.replace('http://blahblah.com')">
     <!-- optional "if you are not redirected..." blurb -->
   </body>
<html>

NB I haven't actually *tried* this :-)

Paul Singleton


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.9/72 - Release Date: 14/Aug/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: session problems: www.blahblah.com versus blahblah.com

Posted by Michael Teter <mi...@gmail.com>.
I tried that, but it's not working.

I tried:
<Host name="blahblah.com">
  <Alias>www.blahblah.com</Alias>
</Host>

and I also tried:
<Host name="www.blahblah.com">
  <Alias>blahblah.com</Alias>
</Host>

Both ways, I still got a session cookie associated with the name the
user entered as the address.  If the user then changed the address to
www., it created a new session and session cookie (with the new name).

On 8/15/05, Peter Rossbach <pr...@objektpark.de> wrote:
> Hmm,
> 
> I thing  a host alias at for your tomcat configuration was helpfull :-)
> 
> <Host name="blahblah.com" >
>     <Alias>www.blahblah.com</Alias>
> 
> </Host>
> 
> Peter
> 
> Michael Teter schrieb:
> 
> >Howdy.
> >
> >I'm having some problems with sessions.
> >
> >If my users come to "blahblah.com", then go away, then return, they
> >get a new session id (for www.blahblah.com).
> >
> >But if they come to www.blahblah.com, leave, and return (via link from
> >external site), they keep the same session.
> >
> >I finally discovered that the browser (Firefox in this case) ends up
> >with two different session cookies - one for www.blahblah.com and one
> >for blahblah.com.
> >
> >What's the right thing to do to solve this?
> >
> >Thanks much.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: session problems: www.blahblah.com versus blahblah.com

Posted by Peter Rossbach <pr...@objektpark.de>.
Hmm,

I thing  a host alias at for your tomcat configuration was helpfull :-)

<Host name="blahblah.com" >
    <Alias>www.blahblah.com</Alias>

</Host>

Peter

Michael Teter schrieb:

>Howdy.
>
>I'm having some problems with sessions.
>
>If my users come to "blahblah.com", then go away, then return, they
>get a new session id (for www.blahblah.com).
>
>But if they come to www.blahblah.com, leave, and return (via link from
>external site), they keep the same session.
>
>I finally discovered that the browser (Firefox in this case) ends up
>with two different session cookies - one for www.blahblah.com and one
>for blahblah.com.
>
>What's the right thing to do to solve this?
>
>Thanks much.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org