Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session middleware and 1.2.8 #65

Open
nathany opened this issue Mar 17, 2014 · 8 comments
Open

session middleware and 1.2.8 #65

nathany opened this issue Mar 17, 2014 · 8 comments

Comments

@nathany
Copy link

nathany commented Mar 17, 2014

RuntimeError at /delayed_job/overview
you need to set up a session middleware *before* Rack::Protection::AuthenticityToken

I'm not sure how.

We're setting up DJ in our config.ru as per the readme:

if Rails.env.production? || Rails.env.staging?
  DelayedJobWeb.use Rack::Auth::Basic do |username, password|
    username == ENV["DJWEB_USERNAME"] && password == ENV["DJWEB_PASSWORD"]
  end
end

run Rack::URLMap.new \
  "/" => Octopus::Application,
  "/delayed_job" => DelayedJobWeb

And currently using activerecord-session_store configured in a session_store.rb initializer:

Rails.application.config.session_store :active_record_store
@plindelauf
Copy link

+1. I'm having the exact same problem.

@andyatkinson
Copy link
Collaborator

This seems related to a recent change from @toolmantim. Tim- in the set options in the sinatra app is the order causing this issue? It looks like you have declared sessions before authenticity token but maybe you could double check?

@toolmantim
Copy link
Contributor

If you're using it alongside Rails, but not from within the Rails router (like the above code), try adding the following to your config.ru:

DelayedJobWeb.enable :sessions

@plindelauf
Copy link

Yep. That does the trick for me. Thanks, @toolmantim

@jontyD
Copy link

jontyD commented Apr 25, 2014

Fixed it for me too, thanks for the advice.

@nathany
Copy link
Author

nathany commented Apr 28, 2014

Thanks @toolmantim.

@jontyD
Copy link

jontyD commented Apr 29, 2014

@toolmantim however, I ran into further difficulties when I found I couldn't do update or delete anything because I got the forbidden page - no csrf token?

I rolled our app back to 1.2.0 for the moment and that is still working great.

@nathany
Copy link
Author

nathany commented Apr 29, 2014

@jontyD See #68 and #59 for that. Still having the csrf issue here too.

Perhaps DelayedJobWeb.enable :sessions should be added to the README? Otherwise it sounds like this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants