Update middleware.rb