# Crow: crow::CORSHandler Struct Reference

crow::CORSHandler Struct Reference

CORSHandler is a global middleware for setting CORS headers. More...

`#include <cors.h>`

## Classes

struct | context

## Public Member Functions

void | before_handle (crow::request &, crow::response &, context &)
void | after_handle (crow::request &req, crow::response &res, context &)
CORSRules & | prefix (const std::string &prefix)
| Handle CORS on a specific prefix path.
CORSRules & | blueprint (const Blueprint &bp)
| Handle CORS for a specific blueprint.
CORSRules & | global ()
| Get the global CORS policy.

## Detailed Description

CORSHandler is a global middleware for setting CORS headers.

By default, it sets Access-Control-Allow-Origin/Methods/Headers to "*". The default behaviour can be changed with the `global()` cors rule. Additional rules for prexies can be added with `prefix()`.

The documentation for this struct was generated from the following file:

- include/crow/middlewares/cors.h