CORS

after-hook

defn

(Fn [a, b, Response] Response)

                        (after-hook req params resp)
                    

adds CORS headers 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 with CORS headers, or Nothing for non-OPTIONS requests.

configure

defn

(Fn [String] ())

                        (configure allowed-origin)
                    

sets the allowed origin for CORS. Use setup for full configuration.

credentials

def

Bool

expose-headers

def

String

headers

def

String

max-age

def

String

methods

def

String

origin

def

String

set-credentials!

defn

(Fn [Bool] ())

                        (set-credentials! c)
                    

enables or disables Access-Control-Allow-Credentials. Origin must not be * when enabled.

set-expose-headers!

defn

(Fn [String] ())

                        (set-expose-headers! h)
                    

sets the Access-Control-Expose-Headers value. Pass an empty string to omit (the default).

setup

defn

(Fn [String, String, String, String] ())

                        (setup o m h ma)
                    

configures CORS origin, methods, headers, and max-age.