Fork me on GitHub
#reitit
<
2022-12-23
>
lepistane13:12:19

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 work

lepistane15:12:17

@U11EL3P9U any chance you have time to take a look?

dharrigan17:12:53

I can have a look, perhaps we can figure it out. You can DM me if you like.

lepistane17:12:44

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

dharrigan17:12:05

Okay. I'm floating about, so not 100% at the keyboard.

dharrigan17:12:27

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.

👍 1
dharrigan17:12:48

Like, squashed commits 🙂 Only the good stuff 🙂

lepistane20:12:03

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.

lepistane17:12:31

Alright i've successfully wasted whole day trying to make CORS work i've tried everything there is to try. I give up

jasonjckn22:12:16

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?

jasonjckn22:12:50

also if the code is available anywhere, i'd be happy to read it

jasonjckn22:12:43

Seems like some of the perf is reliant on undertow (? but it's pre-alpha software https://github.com/metosin/pohjavirta