diff options
Diffstat (limited to 'include/cors_preflight.hpp')
-rw-r--r-- | include/cors_preflight.hpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/cors_preflight.hpp b/include/cors_preflight.hpp new file mode 100644 index 0000000000..6fa9c0a283 --- /dev/null +++ b/include/cors_preflight.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include <app.h> +#include <http_request.h> +#include <http_response.h> + +namespace cors_preflight +{ +void requestRoutes(App& app) +{ + BMCWEB_ROUTE(app, "<str>") + .methods(boost::beast::http::verb::options)( + [](const crow::Request& req, crow::Response& res) { + // An empty body handler that simply returns the headers bmcweb + // uses This allows browsers to do their CORS preflight checks + res.end(); + }); +} +} // namespace cors_preflight |