Problems with Rails cookie settings

I have a Rails application that sets a cookie and redirects it to another server after the user logs in. However, the cookie that the Rails application installs is not considered by the server for any reason. I tried setting http_only to false, but I still can’t see the cookie, unless the domain matches my Rails application. Here is the code I use to set the cookie:

cookies[:dev_appserver_login] = 
  { :value => "#{email}:#{nick}:#{admin}:#{hsh}",
    :domain => "webserver-to-redirect-to",
    :expires => 30.days.from_now }

redirect_to session[:dest_url]

If I manually create a cookie with a web developer extension in Firefox, it works fine, but not when Rails does it. Any ideas?

+3
source share
3 answers

? "" , , a.example.com b.example.com, "domain" .example.com, b.example.com, .

( , .com TLD, , , cookie a.example.com b.somewhereelse.com, , whereelse.com.)

+9

cookie, Rails.

, cookie. IP, , -, "" IP-, .

+1

, /etc/hosts .

127.0.0.1 app1.localdev.com, app2.localdev.com

, cookie, .localdev.com( ), localdev.com .

( , ) - -, appdomain.com 1 appdomain.com/other -app/ . cookie.

0

Source: https://habr.com/ru/post/1698605/


All Articles