|
Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
|
CORS middleware implementation. More...

Functions | |
| void | csilk_cors_middleware (csilk_ctx_t *c, const csilk_cors_config_t *config) |
| CORS middleware — sets cross-origin headers and handles preflight requests. | |
CORS middleware implementation.
| void csilk_cors_middleware | ( | csilk_ctx_t * | c, |
| const csilk_cors_config_t * | config | ||
| ) |
CORS middleware — sets cross-origin headers and handles preflight requests.
CORS middleware — handles preflight and adds CORS headers.
Applies the configured Access-Control-* headers to every response. When the Vary: Origin header is set for non-wildcard origins. If the incoming request is an OPTIONS preflight (indicated by Access-Control-Request-Method), the middleware short-circuits with a 204 No Content response instead of forwarding to downstream handlers.
| c | The request context. |
| config | Pointer to a CORS configuration struct specifying allowed origins, methods, headers, credentials, and max-age. Must remain valid for the duration of the call. |