-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Sidekiq web messes up user sessions #3377
Comments
Hello @heaven, When mounting the E.G. app = Sidekiq::Web.new
app.use Rack::Session::Cookie, options See this page on how to configure it. Do not forget to pass PS: It seems that it's possible to pass the session options with: |
I can but it anyway then runs |
It does, but it also performs a few other actions that I don't completely understand so I have to copy a decent part of this method. Is there a way to copy application settings inside |
@heaven I can't know the context of your question without seeing the changes you are performing. There should be no reason you'd need to inspect how The only two middlewares loaded by default are You could try using the Don't forget that these options should be supplied before mounting the |
@badosu this worked, thanks: Sidekiq::Web.set :sessions, { domain: ".domain.com" } Was wondering if this could be detected in Sidekiq, from the :domain option that I pass in session_store.rb |
@heaven Glad it worked! AFAIK Sidekiq Web is totally agnostic of the framework you're using as long as it's a Rack application. |
@heaven I found another solution to this, in case anyone else is Googling: config/initializers/session_store.rb require 'sidekiq/web'
Rails.application.config.session_store :active_record_store,
key: '_my_session_key'
# Turn off Sinatra's sessions, which overwrite the main Rails app's session
# after the first request
Sidekiq::Web.disable(:sessions) lib/admin_constraint.rb class AdminConstraint
def matches?(request)
user = request.env['warden'].user(:user)
user && user.admin?
end
end config/routes.rb constraints AdminConstraint.new do
mount Sidekiq::Web => '/admin/sidekiq'
end |
Ruby version: 2.3.1
Sidekiq / Pro / Enterprise version(s): 4.2.9
Our app is running on a subdomain, like "sub.domain.com". We have sessions configured to be shared across all subdomains:
After accessing the app a session is created and stored for ".domain.com". But after accessing "/sidekiq" another session appears in cookies for "sub.domain.com", which breaks the app, log out and a few other things.
The text was updated successfully, but these errors were encountered: