Add rack-rewrite to handle redirects

We are moving bulk edit to a different route and we want to be able to
handle redirects on this route. Handling this at the rack level before
the rails stack is the most performant way outside of rewrites on the
web server itself.
This commit is contained in:
Frank West
2018-06-08 08:38:39 -07:00
committed by Maikel Linke
parent 8324b00999
commit f7848b025f
3 changed files with 10 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ gem 'geocoder'
gem 'gmaps4rails'
gem 'spinjs-rails'
gem 'rack-ssl', require: 'rack/ssl'
gem 'rack-rewrite'
gem 'custom_error_message', github: 'jeremydurham/custom-err-msg'
gem 'angularjs-file-upload-rails', '~> 1.1.6'
gem 'roadie-rails', '~> 1.0.3'

View File

@@ -543,6 +543,7 @@ GEM
rack (>= 0.4)
rack-livereload (0.3.16)
rack
rack-rewrite (1.5.1)
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
@@ -775,6 +776,7 @@ DEPENDENCIES
pry-byebug (>= 3.4.3)
rabl
rack-livereload
rack-rewrite
rack-ssl
rails (~> 3.2.22)
rails-i18n (~> 3.0.0)

View File

@@ -0,0 +1,7 @@
module Openfoodnetwork
class Application < Rails::Application
config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
r301 '/admin/products/bulk_edit', '/admin/products' # TODO: Date added 15/06/2018
end
end
end