Allows to set CORS-headers as specified in https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS. It will also setup the infrastructure in order to receive OPTIONS requests send to path.

cors(jug, path = NULL, allow_methods = c("POST", "GET", "PUT", "OPTIONS",
  "DELETE", "PATCH"), allow_origin = "*", allow_credentials = NULL,
  allow_headers = NULL, max_age = NULL, expose_headers = NULL)

Arguments

jug

the jug instance

path

the path to bind to

allow_methods

a vector of allowed methods

allow_origin

the allowed origin

allow_credentials

either true or false (supply as string)

allow_headers

a vector of allowed headers

max_age

in seconds

expose_headers

a vector of exposed headers