Used for tuning CORS policies. More...
Public Member Functions | |
CORSRules & | origin (const std::string &origin) |
Set Access-Control-Allow-Origin. Default is "*". More... | |
CORSRules & | methods (crow::HTTPMethod method) |
Set Access-Control-Allow-Methods. Default is "*". More... | |
template<typename... Methods> | |
CORSRules & | methods (crow::HTTPMethod method, Methods... method_list) |
Set Access-Control-Allow-Methods. Default is "*". More... | |
CORSRules & | headers (const std::string &header) |
Set Access-Control-Allow-Headers. Default is "*". More... | |
template<typename... Headers> | |
CORSRules & | headers (const std::string &header, Headers... header_list) |
Set Access-Control-Allow-Headers. Default is "*". More... | |
CORSRules & | max_age (int max_age) |
Set Access-Control-Max-Age. Default is none. More... | |
CORSRules & | allow_credentials () |
Enable Access-Control-Allow-Credentials. More... | |
void | ignore () |
Ignore CORS and don't send any headers. More... | |
CORSRules & | prefix (const std::string &prefix) |
Handle CORS on specific prefix path. More... | |
CORSRules & | blueprint (const Blueprint &bp) |
Handle CORS for specific blueprint. More... | |
CORSRules & | global () |
Global CORS policy. More... | |
Private Member Functions | |
CORSRules ()=delete | |
CORSRules (CORSHandler *handler) | |
void | add_list_item (std::string &list, const std::string &val) |
build comma separated list More... | |
void | set_header_no_override (const std::string &key, const std::string &value, crow::response &res) |
Set header key to value if it is not set. More... | |
void | apply (crow::response &res) |
Set response headers. More... | |
Private Attributes | |
bool | ignore_ = false |
std::string | origin_ = "*" |
std::string | methods_ = "*" |
std::string | headers_ = "*" |
std::string | max_age_ |
bool | allow_credentials_ = false |
CORSHandler * | handler_ |
Friends | |
struct | crow::CORSHandler |
Used for tuning CORS policies.
|
privatedelete |
|
inlineprivate |
|
inline |
Set Access-Control-Allow-Origin. Default is "*".
|
inline |
Set Access-Control-Allow-Methods. Default is "*".
|
inline |
Set Access-Control-Allow-Methods. Default is "*".
|
inline |
Set Access-Control-Allow-Headers. Default is "*".
|
inline |
Set Access-Control-Allow-Headers. Default is "*".
|
inline |
Set Access-Control-Max-Age. Default is none.
|
inline |
Enable Access-Control-Allow-Credentials.
|
inline |
Ignore CORS and don't send any headers.
CORSRules & crow::CORSRules::prefix | ( | const std::string & | prefix | ) |
Handle CORS on specific prefix path.
Handle CORS for specific blueprint.
CORSRules & crow::CORSRules::global | ( | ) |
Global CORS policy.
|
inlineprivate |
build comma separated list
|
inlineprivate |
Set header key
to value
if it is not set.
|
inlineprivate |
Set response headers.
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |