drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
drogon::plugin::SecureSSLRedirector Class Reference

This plugin is used to redirect all non-HTTPS requests to HTTPS (except for those URLs matching a regular expression listed in the 'ssl_redirect_exempt' list). More...

#include <drogon/plugins/SecureSSLRedirector.h>

Inheritance diagram for drogon::plugin::SecureSSLRedirector:
Collaboration diagram for drogon::plugin::SecureSSLRedirector:

Public Member Functions

void initAndStart (const Json::Value &config) override
void shutdown () override
Public Member Functions inherited from drogon::PluginBase
void initialize ()
 This method must be called by drogon.
Public Member Functions inherited from drogon::DrObject< SecureSSLRedirector >
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< SecureSSLRedirector >
static const std::string & classTypeName ()

Detailed Description

This plugin is used to redirect all non-HTTPS requests to HTTPS (except for those URLs matching a regular expression listed in the 'ssl_redirect_exempt' list).

The json configuration is as follows:

{
"name": "drogon::plugin::SecureSSLRedirector",
"dependencies": ["drogon::plugin::Redirector"],
"config": {
"ssl_redirect_exempt": ["^/.*\\.jpg", ...],
"secure_ssl_host": "localhost:8849"
}
}

ssl_redirect_exempt: must be a string or a string array, present a regular expression (for matching the path of a request) or a regular expression list for URLs that don't have to be redirected.

secure_ssl_host: If this string is not empty, all SSL redirects will be directed to this host rather than the originally-requested host.

Enable the plugin by adding the configuration to the list of plugins in the configuration file.

Member Function Documentation

◆ initAndStart()

void drogon::plugin::SecureSSLRedirector::initAndStart ( const Json::Value & config)
overridevirtual

This method must be called by drogon to initialize and start the plugin. It must be implemented by the user.

Implements drogon::PluginBase.

◆ shutdown()

void drogon::plugin::SecureSSLRedirector::shutdown ( )
overridevirtual

This method must be called by drogon to shutdown the plugin. It must be implemented by the user.

Implements drogon::PluginBase.


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