forceHTTPS example


    public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
    {
        $this->request  = $request;
        $this->response = $response;
        $this->logger   = $logger;

        if ($this->forceHTTPS > 0) {
            $this->forceHTTPS($this->forceHTTPS);
        }

        // Autoload helper files.         helper($this->helpers);
    }

    /** * A convenience method to use when you need to ensure that a single * method is reached only via HTTPS. If it isn't, then a redirect * will happen back to this method and HSTS header will be sent * to have modern browsers transform requests automatically. * * @param int $duration The number of seconds this link should be * considered secure for. Only with HSTS header. * Default value is 1 year. * * @return void * * @throws HTTPException */
Home | Imprint | This part of the site doesn't use cookies.