public function isRequestSecured()
{
$remoteAddress = $this->server()->remoteAddress();
$protocol = $this->server()->serverProtocol();
$fwdProto = $this->server()->get($this->getTrustedHeaders()['client_proto']);
if ($fwdProto && $fwdProto != '' && in_array($remoteAddress, $this->getTrustedProxies())) {
$protocol = $fwdProto;
}
$protocol = strtolower($protocol);
$isSecured = in_array($protocol, ['https', 'on', '1']);
if (!$isSecured) {
if (in_array(strtolower($this->server()->https()), ['https', 'on', '1'])) {
$isSecured = true;
}
}
return $isSecured;
}