Reading Rails 4.1 session cookies from Rails 6

Hi, I’m attempting to strangle a legacy Rails 4.1 application by using a proxy in front of it and sending some requests to a new Rails 6 application.

The Rails 4 application is responsible for user authentication and setting the initial session cookie.

Is there a way to get the Rails 6 application to read/write Rails 4.1 compatible session cookies?

Thanks

Tim

Is the Rails 6 app connected to the same database?

If you store the session in a cookie you probably want to use the JsonSerializer for both apps: Rails.application.config.action_dispatch.cookies_serializer = :json

1 Like

Hi Justin, thanks for your interest.

Yes, the applications are connected to the same database.

The Rails 4.1 application is using the cookie session store so I don’t need to consult the database.

I need the Rails 6 application to read/write compatible session cookies until such a time as I can move everything over into that and move to a different session store.

Thanks,

Tim

Hi Petrik, thanks for the suggestion.

I think they’re both set to hybrid at the moment but I’ll try that out as there shouldn’t be any more Marshalled cookies, that was from years ago.

Cheers,

Tim