rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* getting a cookie to work
@ 2010-06-03  5:46 lsiden
  0 siblings, 0 replies; only message in thread
From: lsiden @ 2010-06-03  5:46 UTC (permalink / raw)
  To: Rack Development

My Sinatra app sets a cookie whose value is 'myapp.heroku.com', then
redirects:

     CALC_URL = 'http://localhost:4020/alc'

      domain = ENV['URL'] || 'localhost'
      logger.info "cookie domain=#{domain}"
      response.set_cookie 'session_id', {
        :value => session_id,
        :domain => domain,
        :path => '/',
      }

      redirect CALC_URL

Here is the log message:

  INFO -- : cookie domain=myapp.heroku.com

But when I examine the cookie with Firebug, it's domain is
'.myapp.heroku.com', not 'myapp.heroku.com'.  In other words,
something has added a dot in front of the domain.  And when the app
makes an AJAX call to myapp.heroku.com, the cookie is not included,
and therefor it fails.

Can anyone tell me where the dot is coming from and what I need to do
so that the browser will send the cookie when it makes requests to
myapp.heroku.com?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-03  5:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-03  5:46 getting a cookie to work lsiden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).