```ruby
module HerokuRequestId
  class Railtie < Rails::Railtie
    initializer 'heroku_request_id.add_middleware' do |app|
      app.config.middleware.insert_after 'Rack::Lock', "HerokuRequestId::Middleware"
    end
  end
end
```

Insert the middleware absolutely first in the stack, instead of after Rack::Lock.
user
```ruby
module HerokuRequestId
  class Railtie < Rails::Railtie
    initializer 'heroku_request_id.add_middleware' do |app|
      app.config.middleware.insert 0, "HerokuRequestId::Middleware"
    end
  end
end
```
assistant