This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-04
Channels
- # boot (41)
- # cljs-dev (1)
- # cljsrn (64)
- # clojure (63)
- # clojure-argentina (2)
- # clojure-austin (1)
- # clojure-russia (1)
- # clojure-spec (1)
- # clojure-uk (59)
- # clojurebridge (1)
- # clojurescript (45)
- # cursive (3)
- # datascript (7)
- # dirac (34)
- # emacs (15)
- # hoplon (1)
- # jobs-discuss (1)
- # jobs-rus (5)
- # klipse (180)
- # lumo (3)
- # om-next (1)
- # re-frame (7)
- # reagent (6)
- # ring (20)
- # specter (10)
- # testing (2)
- # uncomplicate (15)
- # untangled (39)
guys, I wanna use a wrapper for my routes. `(defn wrap-metamiddlewares [rs] (reduce (fn [xs r] (conj xs (reduce (fn [ir m] (apply compojure.core/wrap-routes ir m)) r (-> r meta :middleware)))) [] rs))` for defined routes like this; ` (defroutes ^{:doc “............" :middleware [[buddy.auth.accessrules/restrict {:handler #(identity true) :on-error (layout/error-page {:status 403 :message ""})}]]} main-route ............))`
My code work but I can’t go to page, it takes me to this; `(defn wrap-context [handler] (fn [request] (binding [app-context (if-let [context (:servlet-context request)] ;; If we're not inside a servlet environment ;; (for example when using mock requests), then ;; .getContextPath might not exist (try (.getContextPath ^ServletContext context) (catch IllegalArgumentException _ context)) ;; if the context is not specified in the request ;; we check if one has been specified in the environment ;; instead (:app-context env))] (handler request))))` Wrong number of args (1)
@weavejester do you think something like the following would work
`
(def main-ring-handler
"**NB**: Sente requires the Ring `wrap-params` + `wrap-keyword-params`
middleware to work. These are included with
`ring.middleware.defaults/wrap-defaults` - but you'll need to ensure
that they're included yourself if you're not using `wrap-defaults`."
(let [ssd ring.middleware.defaults/secure-site-defaults]
(assoc ssd :proxy true)
(ring.middleware.defaults/wrap-defaults
ring-routes
ssd)))
`because I can access my site using r.m.d/site-defaults but simply get a http://localhost redirect when I am trying to use the secure-site-defaults, even with the code above
@scknkkrer do you know which fxn is expecting more args?
Yeah, I am getting close to fix. But I don’t get it. buddy.auth.accessrules/restrict wrapper is expecting an argument a map for auth fn and error value.
I am trying with another middleware and getting normal page. 😄 I don’t get it guys...
@scknkkrer have not used buddy to comment intelligently.. it's for authentication right?
@sova You’re not assigning :proxy
to true. Remember that maps in Clojure are immutable.
Oh. Good point.
But something like
(let [ssd (assoc ring.middleware.defaults/secure-site-defaults :proxy true)] ...
and then using ssd would work, yes?
Man I wish someone would whack me over the head with a functional programming baton, but i don't think it'd materialize until the instant I needed it
@sova, yes.
Assuming that your proxy is set up correctly and there aren’t any other issues.