jtrupiano / rack-rewrite

A web server agnostic rack middleware for defining and applying rewrite rules. In many cases you can get away with Rack::Rewrite instead of writing Apache mod_rewrite rules.
http://github.com/jtrupiano/rack-rewrite
MIT License
836 stars 80 forks source link

How I can write logs before redirect an URL? #89

Open arnolfontalvo opened 6 years ago

arnolfontalvo commented 6 years ago

I have this configuration on mi config.ru file

require 'rack/rewrite' use Rack::Rewrite do r302 %r{/marketing/([^\?])(\?.)*}, '/$1' end

I want make rails write log before redirect.

Example: this route http://limbiq.test:3000/marketing/admin/login will redirect to http://limbiq.test:3000/admin/login, but not log information is writing. do you have any Idea to do this?

pascalbetz commented 6 years ago

Should be possible by supplying a Proc like so:

https://github.com/jtrupiano/rack-rewrite#arbitrary-rewriting