<p>I have a Rails app that sets a cookie and does a redirect to another server once the user is logged in. However, the cookie that the Rails app sets isn't seen by the server for some reason. I've tried setting http_only to false but I still can't even see the cookie unless the domain is the same as my Rails app. Here's the code I'm using to set the cookie:</p>

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

redirect_to session[:dest_url]
</code></pre>

<p>If I manually create a cookie with the <a href="https://addons.mozilla.org/en-US/firefox/addon/60" rel="nofollow noreferrer">Web Developer extension</a> in Firefox it works fine, but not when Rails does it. Any ideas?</p>

What are the redirecting and redirected-to servers? You can only set ‘domain’ to the current hostname or a parent domain, so if you're on a.example.com and you're redirecting to b.example.com, you have to set ‘domain’ to .example.com,
not
b.example.com as implied in the code snippet.
(And open domains like the .com TLD aren't themselves allowed as domain values, so if you want to pass a cookie from a.example.com to b.somewhereelse.com you will need a more complicated solution probably involving changing the code on somewhereelse.com.)