clojurecsrfcompojureringliberator

How to disable CSRF token for specific endpoints(URLs) with Ring in Clojure?


I have a web app which has CSRF protection but I need to disable this protection for some endpoints(public APIs) so I can send Rest calls without having problem.

Here is my code:

(def handler (-> route.all/routes
                 log-middleware
                 (wrap-defaults site-defaults);;which provides CSRF protection
                 wrap-exceptions
                 wrap-reload
                 wrap-gzip))

(defn start
  [port]
  (jetty/run-jetty handler {:port port}))

P.S: I use Liberator along with Ring


Solution

  • Thanks to James Reeves, he has answered this question over here