protected function redirectToScheme(HTTPRequest $request, $scheme, $host = null)
    {
        if (!$host) {
            $host = $request->getHost();
        }

        $url = Controller::join_links("{$scheme}://{$host}", Director::baseURL(), $request->getURL(true));

        // Force redirect
        $response = HTTPResponse::create();
        $response->redirect($url, $this->getRedirectType());

        return $response;
    }