From 3acc52350ae9b47dad545ef0b5663521cc8f0ca1 Mon Sep 17 00:00:00 2001 From: Adrien S Date: Thu, 4 May 2023 08:51:41 +0200 Subject: [PATCH] Update blurb on middleware stack (#331) --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1bfc8b5e..adc61575 100644 --- a/README.md +++ b/README.md @@ -526,16 +526,11 @@ Rails.application.config do |config| end ``` -Specifically, if you use a Rack middleware-based authentication solution (such as Warden) in a Rails application and wish to use it for authenticating message_bus requests, you must ensure that the MessageBus middleware comes after it in the stack. Unfortunately, this can be difficult, but the following solution is known to work: +Specifically, if you use a Rack middleware-based authentication solution (such as Warden) in a Rails application and wish to use it for authenticating message_bus requests, you must ensure that the MessageBus middleware comes after it in the stack. ```ruby # config/initializers/message_bus.rb -Rails.application.config do |config| - # See https://github.com/rails/rails/issues/26303#issuecomment-442894832 - MyAppMessageBusMiddleware = Class.new(MessageBus::Rack::Middleware) - config.middleware.delete(MessageBus::Rack::Middleware) - config.middleware.insert_after(Warden::Manager, MyAppMessageBusMiddleware) -end +Rails.application.config.middleware.move_after(Warden::Manager, MessageBus::Rack::Middleware) ``` ### A Distributed Cache