Created
September 28, 2010 14:49
-
-
Save remvee/601124 to your computer and use it in GitHub Desktop.
Ring middleware to force a SSL connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn wrap-force-ssl [app] | |
(fn [req] | |
(if (= :https (:scheme req)) | |
(app req) | |
(let [url (str "https://" (:server-name req) (:uri req))] | |
{:status 302 | |
:headers {"Location" url, "Content-Type" "text/html"} | |
:body (str "<html><body><a href='" url "'>redirecting..</a.></body></html>")})))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment