Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
Cors.hpp
Go to the documentation of this file.
1#pragma once
3#include <string>
4#include <vector>
5
6namespace middleware {
7
13 std::vector<std::string> allowed_origins = {"*"};
14 std::vector<std::string> allowed_methods = {"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"};
15 std::vector<std::string> allowed_headers = {"*"};
16 bool allow_credentials = false;
17 int max_age = 86400; // 24 hours default
18};
19
28
29} // namespace middleware
routing::Middleware cors(CorsOptions options=CorsOptions{})
Returns a middleware that handles CORS.
Definition Cors.cpp:18
Definition Compress.hpp:4
std::function< bool(http::HttpRequest &, std::shared_ptr< http::ResponseWriter >)> Middleware
Definition Router.hpp:17
Options for configuring CORS (Cross-Origin Resource Sharing).
Definition Cors.hpp:12
std::vector< std::string > allowed_methods
Definition Cors.hpp:14
bool allow_credentials
Definition Cors.hpp:16
std::vector< std::string > allowed_origins
Definition Cors.hpp:13
std::vector< std::string > allowed_headers
Definition Cors.hpp:15
int max_age
Definition Cors.hpp:17