Skip to content

Commit

Permalink
Update blurb on middleware stack (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
Intrepidd committed May 4, 2023
1 parent 7c7ecee commit 3acc523
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3acc523

Please sign in to comment.