protected function _toHtml() // @codingStandardsIgnoreLine - required by parent class
    {
        if ($this->config->isGeoIpEnabled() == false || $this->config->isFastlyEnabled() == false) {
            return parent::_toHtml();
        }

        /** @var string $actionUrl */
        $actionUrl = $this->getUrl('fastlyCdn/geoip/getaction');

        // This page has an esi tag, set x-esi header if it is not already set
        $header = $this->response->getHeader('x-esi');
        if (empty($header)) {
            $this->response->setHeader("x-esi", "1");
        }

        // HTTPS ESIs are not supported so we need to turn them into HTTP
        return sprintf(
            '<esi:include src=\'%s\' />',
            preg_replace("/^https/", "http", $actionUrl)
        );
    }