3 CORS
(require koyo/cors) | package: koyo-lib |
This module provides a wrapper function and parameters for handling CORS requests.
parameter
(current-cors-origin) → (or/c #f non-empty-string?)
(current-cors-origin origin) → void? origin : (or/c #f non-empty-string?)
= #f
parameter
(current-cors-methods methods) → void? methods : (listof non-empty-string?)
= '("HEAD" "DELETE" "GET" "PATCH" "POST" "PUT" "OPTIONS")
parameter
(current-cors-headers headers) → void? headers : (listof non-empty-string?)
= '("*")
parameter
(current-cors-max-age max-age) → void? max-age : exact-nonnegative-integer?
= 86400
parameter
(current-cors-credentials-allowed? allowed?) → void? allowed? : boolean?
= #t
These parameters determine the behavior of wrap-cors. Each
one maps to one of the CORS response headers.
When current-cors-origin is #f, the origin is based upon current-application-url-scheme and current-application-url-host.
Augments handler to add the various necessary bits of
information to support CORS in its response. For OPTIONS
requests, wrap-cors takes full control of the request.