This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-23
Channels
- # adventofcode (13)
- # announcements (7)
- # atom-editor (2)
- # babashka (6)
- # beginners (77)
- # biff (2)
- # calva (14)
- # cider (25)
- # circleci (2)
- # clj-on-windows (39)
- # clojars (1)
- # clojure (36)
- # clojure-belgium (4)
- # clojure-europe (78)
- # clojure-norway (25)
- # clojure-spec (1)
- # clojurescript (11)
- # clr (1)
- # cursive (1)
- # datahike (43)
- # datomic (6)
- # dev-tooling (3)
- # emacs (5)
- # exercism (1)
- # jobs (1)
- # jobs-discuss (3)
- # kaocha (2)
- # lsp (32)
- # malli (4)
- # music (1)
- # off-topic (14)
- # pathom (4)
- # reitit (14)
- # shadow-cljs (5)
- # tools-deps (3)
- # vim (1)
- # xtdb (5)
I can't seem to deal with CORS.
I've used https://github.com/metosin/reitit/issues/143#issuecomment-647191697 and all other examples here in the channel and github issues.
What am i doing wrong?
require [ring.middleware.cors :refer [wrap-cors]]
router level :middlware
[swagger/swagger-feature
parameters/parameters-middleware
muuntaja/format-negotiate-middleware
muuntaja/format-response-middleware
(exception/create-exception-middleware
(merge exception/default-handlers
{::exception/default (partial #_exception/wrap-log-to-console
default-exception-handler)}))
muuntaja/format-request-middleware
coercion/coerce-response-middleware
coercion/coerce-request-middleware
multipart/multipart-middleware
[wrap-cors
:access-control-allow-origin [#".*"]
:access-control-allow-methods [:get :post]]
]
eval everything -> still getting cors issues
I tired adding it to route middleware itself - doesn't work
tried this : https://github.com/francesco-losciale/ring-todo-list/commit/2eacfae0c1ee2c0ae6f68d0055dfe84c0601dfab - doesn't worki also implemented https://github.com/dharrigan/startrek/blob/80229247b3651a8593cdd4f9b27902742b1d2833/src/startrek/api/middleware/cors.clj and still it doesn't work. I am surely doing something wrong?
@U11EL3P9U any chance you have time to take a look?
Thanks @U11EL3P9U i will try to reuse minimal example now and see if i am going crazy or what is happening. I will write as i believe discussion will benefit future devs
What I propose is for you to DM me, for it could get noisy, then, when (if!) we have a solution, you can post it here.
Solved it: basically https://github.com/francesco-losciale/ring-todo-list/commit/2eacfae0c1ee2c0ae6f68d0055dfe84c0601dfab and https://github.com/metosin/reitit/issues/143#issuecomment-647191697 Still work, it was testing setup issue that caused same error. Once those were mitigated CORS was solved.
Alright i've successfully wasted whole day trying to make CORS work i've tried everything there is to try.
I give up
techempower benchmarks for reitit are incredibly impressive, surpassing even vert.x, were any tricks pulled to achieve this or is it just regular design patterns?
found the code https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Clojure/reitit/src/hello/handler.clj
Seems like some of the perf is reliant on undertow (? but it's pre-alpha software https://github.com/metosin/pohjavirta