mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
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:
1
Gemfile
1
Gemfile
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
|
||||
7
config/initializers/rack_rewrite.rb
Normal file
7
config/initializers/rack_rewrite.rb
Normal 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
|
||||
Reference in New Issue
Block a user