Last Updated: February 25, 2016
·
1.634K
· killme2008

invalidate cookie on server side in compojure

(defn invalidate-cookie []
  {:value "invalidate."
   :path "/"
   :max-age 0
   :expires "Thu, 01 Jan 1970 00:00:00 GMT"})

Then assoc the new cookie to request:

(defn signout [req]
  {:status 200 :cookies (assoc (:cookies req) "cookie_key" (invalidate-cookie) :body "..."})