Class HttpsEnforcerMiddleware
Enforces use of HTTPS (SSL) for requests.
Namespace: Cake\Http\Middleware
Property Summary
-
$config protected
array<string, mixed>
Configuration.
Method Summary
-
__construct() public
Constructor
-
process() public
Check whether request has been made using HTTPS.
Method Detail
__construct() ¶ public
__construct(array<string, mixed> $config = [])
Constructor
Parameters
-
array<string, mixed>
$config optional The options to use.
See Also
\Cake\Http\Middleware\HttpsEnforcerMiddleware::$config
process() ¶ public
process(ServerRequestInterface $request, RequestHandlerInterface $handler): Psr\Http\Message\ResponseInterface
Check whether request has been made using HTTPS.
Depending on the configuration and request method, either redirects to same URL with https or throws an exception.
Parameters
-
ServerRequestInterface
$request The request.
-
RequestHandlerInterface
$handler The request handler.
Returns
Psr\Http\Message\ResponseInterface
Throws
Cake\Http\Exception\BadRequestException
Property Detail
$config ¶ protected
Configuration.
Options
redirect
- If set to true (default) redirects GET requests to same URL with https.statusCode
- Status code to use in case of redirect, defaults to 301 - Permanent redirect.headers
- Array of response headers in case of redirect.disableOnDebug
- Whether HTTPS check should be disabled when debug is on. Defaulttrue
.
Type
array<string, mixed>