|
drogon
C++14/17-based HTTP application framework
|
Simple middleware that tags OPTIONS requests. More...
#include <drogon/HttpMiddleware.h>


Public Member Functions | |
| void | invoke (const HttpRequestPtr &req, MiddlewareNextCallback &&nextCb, MiddlewareCallback &&mcb) override |
| Public Member Functions inherited from drogon::DrObject< Derived > | |
| const std::string & | className () const override |
| Get the class name. | |
| bool | isClass (const std::string &class_name) const override |
| Return true if the class name is 'class_name'. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from drogon::DrObject< Derived > | |
| static const std::string & | classTypeName () |
| Static Public Attributes inherited from drogon::HttpMiddleware< Derived, true > | |
| static constexpr bool | isAutoCreation |
Simple middleware that tags OPTIONS requests.
It adds the attribute "drogon.customCORShandling" to the request, so that HttpServer does not handle CORS for them internally.
This allows custom CORS handling via the path handlers. For example to restrict the origins, headers allowed, specify a max age to avoid OPTIONS on every request, etc.
Just register it:
|
inlineoverridevirtual |
This virtual function should be overridden in subclasses.
Example:
Implements drogon::HttpMiddlewareBase.