Redirect routes with trailing slashes

See: https://github.com/hanami/router/issues/256
This commit is contained in:
2023-11-19 09:35:59 +11:00
parent f63df9b1ca
commit e48affacb8
3 changed files with 9 additions and 0 deletions

View File

@@ -12,4 +12,10 @@ use Rack::Session::Cookie,
:expire_after => 3600*24,
:secret => ENV["SESSION_SECRET"]
require "rack/rewrite"
use Rack::Rewrite do
# remove trailing slashes
r302 %r{(/.*)/(\?.*)?$}, "$1$2"
end
run Hanami.app