luminus

2019-02-20T16:28:28.001500Z

Hi @macrobartfast, I just happened to try CORS with swagger today. I modified the middleware.clj like this. It worked.

(defn wrap-base [handler]
  (-> ((:middleware defaults) handler)
      wrap-auth
      wrap-webjars
      wrap-flash
      (wrap-cors :access-control-allow-origin [#"<http://10.20.30.40:4100>"]
                 :access-control-allow-methods [:get :put :post :delete])
      (wrap-session {:cookie-attrs {:http-only true}})
      (wrap-defaults
       (-&gt; site-defaults
           (assoc-in [:security :anti-forgery] false)
           (dissoc :session)))
      wrap-internal-error))

2019-02-20T17:33:05.003900Z

I got certain problems when I directly moved regex pattern #"<http://10.20.30.40:4100>" to env/dev/resources/config.edn Finally, I put only string part at env/dev/resources/config.edn and I wrote code like (re-pattern (:cors-regex-str env)) to create regex pattern.