rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: kigster <kigster@gmail.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Re: Cookieless response
Date: Mon, 26 Jul 2010 14:46:11 -0700 (PDT)	[thread overview]
Message-ID: <d3c94106-657a-4426-9873-1c790c4bd930@i21g2000yql.googlegroups.com> (raw)
In-Reply-To: <7f287e5d-f757-4390-a226-34f3ae2613b9@i28g2000yqa.googlegroups.com>

I am having the same issue.  The reason is that Rails routing runs
last, after session and every other rack middleware.  Here is the
output of my "rake middleware" task:

use ActionDispatch::Static
use Rack::Lock
use ActiveSupport::Cache::Strategy::LocalCache
use Rack::Runtime
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::RemoteIp
use Rack::Sendfile
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::MethodOverride
use ActionDispatch::Head
run Kigster::Application.routes

Because the routes run last, by the time the Rack/Sinatra application
is invoked, it ends up being inside of the Session::CookieStore which
wraps the response in the cookie.

With Rails Metal it was possible to bypass Rack completely, and build
routes that do not require Rails Router to get activated.  I just
tried doing "rails g metal" and my Rails3 project does not know this
generator.  So I am not sure how to create a pre-routing app handler
that would also bypass sessions.

Any help appreciated.

Konstantin

On Jul 16, 12:43 pm, Ryan  S <musicmanr...@gmail.com> wrote:
> So let's say I just have a simple rack app
>
> class SimpleApp
>   def self.call(env)
>     [200, {}, "I don't want no cookies!"] #I am a grammarian
>   end
> end
>
> A rails route:
>
> root :to => SimpleApp
>
> Where do I add this middleware that suppresses the cookie from the
> response? This may not even be possible to just suppress a cookie for
> one response as the domain as a whole uses cookies so this may just be
> my lack of understanding here.
>
> On Jul 16, 2:23 pm, Konstantin Haase <k.ha...@finn.de> wrote:
>
>
>
> > On Jul 16, 2010, at 21:11 , Ryan S wrote:
>
> > > So I am using a basic rack app in my rails 3 project to serve a
> > > javascript file from a git repo and will pull different versions of
> > > the file based on a query param.
>
> > > I notice in the headers that there is a 'Set-Cookie ' cookie header. I
> > > can't seem to get that to go away. Is it possible to have a response
> > > without a cookie?
>
> > Make sure you have no session middleware in your stack.
>
> > Konstantin

      parent reply	other threads:[~2010-07-26 22:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-16 19:11 Cookieless response Ryan S
2010-07-16 19:23 ` Konstantin Haase
2010-07-16 19:43   ` Ryan S
2010-07-16 19:47     ` Konstantin Haase
2010-07-16 20:02       ` Ryan S
2010-07-19 18:32         ` José Valim
2010-07-26 21:46     ` kigster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3c94106-657a-4426-9873-1c790c4bd930@i21g2000yql.googlegroups.com \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).