Thanks a lot Paul, this was the solution. In the wiki, you may add that this config has to be set in the application server, not in the load-balancer server, (I was not sure and tested both).


On 17/08/12 01:17, Paul Cowan wrote:

On Aug 16, 2012, at 4:57 PM, Riccardo Cohen wrote:

Hello
I use resin 4.0.13, and I have one unique application that is accessed though 2 domains. It is configured in the front server as host alias :

    <host id="www.appartement-maison.fr" >
      <host-alias>pro.appartement-maison.fr</host-alias>

The 2 domains are in the same java application, but they answer completely different pages for different functions.

When a user is connected to the first domain with a login/password (connection information is stored in the session), I would like him to be automatically connected in the second domain. But the JSESSIONID is different so the connection information is not found, while it is the same application and the same browser.

Is it possible to share the sessions between different host aliases in one application ?
If not I will have to use a subdirectory in the first domain, which is not what we want.
I found nothing in the reference doc of <session-config> about this, and could not find a thread in this list about it.

PS: here I don't need to share cookies, only server sessions.


Hi Riccardo,

You do need to share cookies, because the session is tied to the JSESSIONID.  You're getting different sessions because the Set-cookie domain defaults to the full host name, which is different in your case between www... and pro...

If all your host names end with "appartement-maison.fr", then simply set 

<session-config>
  <cookie-domain>appartement-maison.fr</cookie-domain>
  ...
</session-config>

If you have more than one domain, or need more control you can use cookie-domain-regexp.

cookie-domain-regexp accepts a regular _expression_ used to extract the domain from the requested host. Probable configuration:

<session-config>
  <cookie-domain-regexp>[^.]*\.[^.]*$</cookie-domain-regexp>
  ...
</session-config>

For example, using this regexp will produce the following:

Host: xxx.yyy.zzz.foo.com =  Set-Cookie domain: foo.com
Host: zzz.foo.com =  Set-Cookie domain: foo.com
Host: foo.com =  Set-Cookie domain: foo.com
Host: bar.com =  Set-Cookie domain: bar.com

(I'll adding this all to wiki4.caucho.com shortly.)

Thanks,
Paul




Thanks.

--
Riccardo Cohen
+33 (0)6 09 83 64 49
Société Realty-Property.com
1 rue de la Monnaie
37000 Tours
France

www.appartement-maison.fr

<eccjgbbd.jpg>
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest




_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

--
Riccardo Cohen
+33 (0)6 09 83 64 49
Société Realty-Property.com
1 rue de la Monnaie
37000 Tours
France

www.appartement-maison.fr


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to