mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Make session and protection the first middlewares
This commit is contained in:
parent
8d8fc591a1
commit
29b35774ad
1 changed files with 8 additions and 8 deletions
|
@ -109,22 +109,22 @@ module Sidekiq
|
|||
end
|
||||
|
||||
def build
|
||||
middlewares = self.middlewares
|
||||
klass = self.class
|
||||
|
||||
unless using?(::Rack::Protection) || ENV['RACK_ENV'] == 'test'
|
||||
middlewares.unshift [[::Rack::Protection, { use: :authenticity_token }], nil]
|
||||
end
|
||||
|
||||
unless using? ::Rack::Session::Cookie
|
||||
unless secret = Web.session_secret
|
||||
require 'securerandom'
|
||||
secret = SecureRandom.hex(64)
|
||||
end
|
||||
|
||||
use ::Rack::Session::Cookie, secret: secret
|
||||
middlewares.unshift [[::Rack::Session::Cookie, { secret: secret }], nil]
|
||||
end
|
||||
|
||||
unless using?(::Rack::Protection) || ENV['RACK_ENV'] == 'test'
|
||||
use ::Rack::Protection, use: :authenticity_token
|
||||
end
|
||||
|
||||
middlewares = self.middlewares
|
||||
klass = self.class
|
||||
|
||||
::Rack::Builder.new do
|
||||
%w(stylesheets javascripts images).each do |asset_dir|
|
||||
map "/#{asset_dir}" do
|
||||
|
|
Loading…
Reference in a new issue