Keep sessions while switching domains


Our rails app has several domains. We are now implementing a single
https connection https://secure.domain.xx.
All other domains need to switch to that new secure domain in certain
We only have one ssl cert and it is not possible to create and use a
ssl cert for all domains!

Now when switching domains we loose the session, that was previously
used and I was not able to restore my old session.
I was trying to send the old session id via the url and then reuse it
by setting it again like this:

redirect_to :host => ‘’ , :session_key =>
request.cookies[’_xxx_session_id’][0] unless (request.env[‘HTTP_HOST’]
== ‘’)

cookies[:_xxx_session_id] = params[:session_key]

This failed since rails seems to regenerate a new session id somehow
at a later stage. The new session cookie will have this newly
generated id.

How can I tell Rails to use my session id ?
Has anybody an idea on how to do this? I must get the old session
transferred to the new domain in order to access the session data.

Many thanks in advance for any help on this.