# Crow: crow::CORSRules Struct Reference

crow::CORSRules Struct Reference

Used for tuning CORS policies. More...

`#include <cors.h>`

## Public Member Functions

CORSRules & | origin (const std::string &origin)
| Set Access-Control-Allow-Origin. Default is "*".
CORSRules & | methods (crow::HTTPMethod method)
| Set Access-Control-Allow-Methods. Default is "*".
template<typename... Methods>
CORSRules & | methods (crow::HTTPMethod method, Methods... method_list)
| Set Access-Control-Allow-Methods. Default is "*".
CORSRules & | headers (const std::string &header)
| Set Access-Control-Allow-Headers. Default is "*".
template<typename... Headers>
CORSRules & | headers (const std::string &header, Headers... header_list)
| Set Access-Control-Allow-Headers. Default is "*".
CORSRules & | max_age (int max_age)
| Set Access-Control-Max-Age. Default is none.
CORSRules & | allow_credentials ()
| Enable Access-Control-Allow-Credentials.
void | ignore ()
| Ignore CORS and don't send any headers.
CORSRules & | prefix (const std::string &prefix)
| Handle CORS on specific prefix path.
CORSRules & | blueprint (const Blueprint &bp)
| Handle CORS for specific blueprint.
CORSRules & | global ()
| Global CORS policy.

## Friends

struct | crow::CORSHandler

## Detailed Description

Used for tuning CORS policies.

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

- include/crow/middlewares/cors.h