1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Add note about sessions and Rails apps in API mode

This commit is contained in:
Mike Perham 2021-04-06 08:02:26 -07:00
parent f508a30281
commit 24c35e64fd
2 changed files with 15 additions and 6 deletions

View file

@ -6,6 +6,8 @@ HEAD
---------
- Update RTT warning logic to handle transient RTT spikes [#4851]
- Fix very low priority CVE on unescaped queue name [#4852]
- Add note about sessions and Rails apps in API mode
6.2.0
---------
@ -36,6 +38,10 @@ If this is a bare Rack app, use a session middleware before Sidekiq::Web:
# now, update your Rack app to include the secret with a session cookie middleware
use Rack::Session::Cookie, secret: File.read(".session.key"), same_site: true, max_age: 86400
run Sidekiq::Web
If this is a Rails app in API mode, you need to enable sessions.
https://guides.rubyonrails.org/api_app.html#using-session-middlewares
```
6.1.3

View file

@ -77,16 +77,19 @@ module Sidekiq
end
If this is a Rails app in API mode, you need to enable sessions.
https://guides.rubyonrails.org/api_app.html#using-session-middlewares
If this is a bare Rack app, use a session middleware before Sidekiq::Web:
# first, use IRB to create a shared secret key for sessions and commit it
require 'securerandom'; File.open(".session.key", "w") {|f| f.write(SecureRandom.hex(32)) }
# first, use IRB to create a shared secret key for sessions and commit it
require 'securerandom'; File.open(".session.key", "w") {|f| f.write(SecureRandom.hex(32)) }
# now use the secret with a session cookie middleware
use Rack::Session::Cookie, secret: File.read(".session.key"), same_site: true, max_age: 86400
run Sidekiq::Web
# now use the secret with a session cookie middleware
use Rack::Session::Cookie, secret: File.read(".session.key"), same_site: true, max_age: 86400
run Sidekiq::Web
EOM
end