This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-23
Channels
- # aleph (8)
- # aws (2)
- # beginners (36)
- # cider (35)
- # cljs-dev (157)
- # cljsjs (3)
- # cljsrn (5)
- # clojure (97)
- # clojure-dev (5)
- # clojure-gamedev (3)
- # clojure-italy (27)
- # clojure-russia (11)
- # clojure-spec (19)
- # clojure-uk (39)
- # clojured (6)
- # clojurescript (87)
- # clojutre (4)
- # community-development (35)
- # cursive (8)
- # datascript (2)
- # datomic (14)
- # dirac (8)
- # duct (3)
- # figwheel (13)
- # fulcro (22)
- # graphql (20)
- # jobs (1)
- # london-clojurians (1)
- # off-topic (55)
- # onyx (3)
- # parinfer (3)
- # protorepl (39)
- # re-frame (3)
- # reagent (26)
- # ring (7)
- # ring-swagger (2)
- # rum (1)
- # shadow-cljs (107)
- # spacemacs (8)
- # test-check (4)
- # unrepl (3)
Hi, does anybody use the ring-cors
library here? https://github.com/r0man/ring-cors
It is supposed to be an "outer part" middleware right? For example if I have a route, other middlewares, and a ring wrap-defaults
, it should look like this right? :
(-> routes
wrap-middlewares
...
...
(wrap-cors :access-control-allow-origin [#""] :access-control-allow-methods [:get :put :post :delete])
(wrap-defaults api-defaults))
@hawari.rahman17 I think you need to swap defaults and cors there.
Yeah, I finally realized that @seancorfield, but sadly the middleware still doesn't work as I expected it to be. It doesn't return any of CORS related headers.
We use it in production and it works just fine.
(ring-cors/wrap-cors handler
:access-control-allow-headers #{"accept"
"authorization"
"content-type"
"origin"}
:access-control-allow-methods [:delete :get
:patch :post :put]
;; 24 hours (in seconds) -- note that only Firefox
;; will honor this; other browsers cap lower!
:access-control-max-age "86400"
:access-control-allow-origin #".*")
That's how we compute our outermost handler.You probably need :access-control-allow-headers
...