This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-30
Channels
- # announcements (3)
- # aws (5)
- # beginners (71)
- # boot (7)
- # calva (74)
- # cider (6)
- # clj-kondo (2)
- # cljs-dev (5)
- # clojars (6)
- # clojure (84)
- # clojure-dev (7)
- # clojure-europe (1)
- # clojure-italy (23)
- # clojure-nl (43)
- # clojure-sanfrancisco (1)
- # clojure-spec (4)
- # clojure-uk (173)
- # clojurebridge (1)
- # clojurescript (14)
- # cursive (44)
- # datomic (9)
- # duct (2)
- # emacs (2)
- # fulcro (4)
- # graalvm (4)
- # graphql (27)
- # hoplon (6)
- # keechma (50)
- # off-topic (3)
- # other-languages (8)
- # pathom (2)
- # pedestal (14)
- # planck (5)
- # re-frame (3)
- # reitit (6)
- # ring (2)
- # robots (2)
- # spacemacs (9)
- # tools-deps (15)
- # vim (44)
could anyone recommend a way to have the allowed-origins
interceptor skip a particular route?
@ccann, you have full control over what interceptors are added. Leveraging Pedestal’s default-interceptors
impl should be considered a convenience and may not be suitable for some use cases. By setting the :io.pedestal.http/interceptors
key on the service map you take full control over what interceptors are added when. If you do this, though, you’ll need to add the router interceptor yourself.
Or you can just add the allowed-origins interceptor yourself in your routes and skip specifying the allowed-origins in your service map
the problem I’m having that led me to ask the question is that for my health check route (a GET request) I’m getting a NPE from my allowed-origins function
and apparently the pedestal cors interceptor calls the allowed-origins
function before determining if the request type is :options
https://github.com/pedestal/pedestal/blob/09dd88c4ce7f89c7fbb7a398077eb970b3785d2d/service/src/io/pedestal/http/cors.clj#L82
Yep, the allow-origin
interceptor is added prior to the router and it is within the router where method-based matching is done
so I guess the “correct” behavior then for a missing Origin header is for the allowed-origins function to return truthy