Ring middleware for defining and applying rewrite/redirect rules. In many 
cases you can get away with ring-rewrite instead of writing Apache 
mod_rewrite rules. Based on rack-rewrite, but with a Clojure flavor.

https://github.com/ebaxt/ring-rewrite

(def redirect-handler
  (fn [req]
    (wrap-rewrite req
                  [:rewrite #"/resources/people/(.+)" "/people/$1" :method 
:get]
                  [:rewrite #"/secret/name/(.+)" "/secret/place/$1" :if (fn 
[{:keys [headers]}]  (= "42" (get headers  "x-secret"))) :not 
"/secret/name/bully"])))

Would love feedback on the code and improvements/additional features.

Cheers

Erik

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to