CORS

after-hook

defn

(Fn [a, b, Response] Response)

                        (after-hook req params resp)
                    

adds Access-Control-Allow-Origin to every response.

before-hook

defn

(Fn [(Ref Request a), b] (Maybe Response))

                        (before-hook req params)
                    

handles CORS preflight OPTIONS requests. Returns a 204 No Content with the appropriate Access-Control-* headers. For non-OPTIONS requests, continues to the handler.

configure

defn

(Fn [String] ())

                        (configure allowed-origin)
                    

sets the allowed origin for CORS. Call before the server starts. The default is * (all origins).

headers

def

String

max-age

def

String

methods

def

String

origin

def

String