(allow-cross-origin handler)
(allow-cross-origin handler allowed-origins)
Middleware function to allow cross origin requests from browsers. When a browser attempts to call an API from a different domain, it makes an OPTIONS request first to see the server's cross origin policy. So, in this method we return that when an OPTIONs request is made. Additionally, for non OPTIONS requests, we need to just return the 'Access-Control-Allow-Origin' header or else the browser won't read the data properly. The above notes are all based on how Chrome works.
Middleware function to allow cross origin requests from browsers. When a browser attempts to call an API from a different domain, it makes an OPTIONS request first to see the server's cross origin policy. So, in this method we return that when an OPTIONs request is made. Additionally, for non OPTIONS requests, we need to just return the 'Access-Control-Allow-Origin' header or else the browser won't read the data properly. The above notes are all based on how Chrome works.
(wrap-base handler)
(wrap-middleware handler)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close