Nexcessnet_Turpentine_Model_Varnish_Configurator_Abstract::_vcl_sub_https_redirect_fix PHP Method

_vcl_sub_https_redirect_fix() protected method

When using Varnish as front door listen on port 80 and Nginx/Apache listen on port 443 for HTTPS, the fix will keep the url parameters when redirect from HTTP to HTTPS.
protected _vcl_sub_https_redirect_fix ( ) : string
return string
    protected function _vcl_sub_https_redirect_fix()
    {
        $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
        $baseUrl = str_replace(array('http://', 'https://'), '', $baseUrl);
        $baseUrl = rtrim($baseUrl, '/');
        switch (Mage::getStoreConfig('turpentine_varnish/servers/version')) {
            case 4.0:
                $tpl = <<<EOS
if ( (req.http.host ~ "^(?i)www.{$baseUrl}" || req.http.host ~ "^(?i){$baseUrl}") && req.http.X-Forwarded-Proto !~ "(?i)https") {
        return (synth(750, ""));
    }
EOS;
                break;
            default:
                $tpl = <<<EOS
if ( (req.http.host ~ "^(?i)www.{$baseUrl}" || req.http.host ~ "^(?i){$baseUrl}") && req.http.X-Forwarded-Proto !~ "(?i)https") {
        error 750 "https://" + req.http.host + req.url;
    }
EOS;
        }
        return $tpl;
    }