diff --git a/app/code/community/Nexcessnet/Turpentine/Model/Varnish/Configurator/Abstract.php b/app/code/community/Nexcessnet/Turpentine/Model/Varnish/Configurator/Abstract.php index 77e4ec675..f539e2b41 100644 --- a/app/code/community/Nexcessnet/Turpentine/Model/Varnish/Configurator/Abstract.php +++ b/app/code/community/Nexcessnet/Turpentine/Model/Varnish/Configurator/Abstract.php @@ -910,11 +910,22 @@ protected function _vcl_sub_https_redirect_fix() { $baseUrl = str_replace(array('http://','https://'), '', $baseUrl); $baseUrl = rtrim($baseUrl,'/'); - $tpl = << Mage::getStoreConfig('turpentine_vcl/maintenance/custom_vcl_synth'))); } + /** + * vcl_synth for fixing https + * + * @return string + */ + protected function _vcl_sub_synth_https_fix() + { + $tpl = $this->_vcl_sub_synth(); + + if(!$tpl){ + $tpl = <<_vcl_sub_https_redirect_fix(); + if(Mage::getStoreConfig('turpentine_varnish/servers/version') == '4.0'){ + $vars['vcl_synth'] = $this->_vcl_sub_synth_https_fix(); + } } foreach (array('','top') as $position) { diff --git a/app/code/community/Nexcessnet/Turpentine/misc/version-3.vcl b/app/code/community/Nexcessnet/Turpentine/misc/version-3.vcl index b960df79a..a391f2d8d 100644 --- a/app/code/community/Nexcessnet/Turpentine/misc/version-3.vcl +++ b/app/code/community/Nexcessnet/Turpentine/misc/version-3.vcl @@ -96,10 +96,10 @@ sub generate_session_expires { {{generate_session_end}} ## Varnish Subroutines -sub vcl_synth { - if (resp.status == 750) { - set resp.status = 301; - set resp.http.Location = "https://" + req.http.host + req.url; +sub vcl_error { + if (obj.status == 750) { + set obj.http.Location = obj.response; + set obj.status = 301; return(deliver); } } diff --git a/app/code/community/Nexcessnet/Turpentine/misc/version-4.vcl b/app/code/community/Nexcessnet/Turpentine/misc/version-4.vcl index efef43060..5b5758b8d 100644 --- a/app/code/community/Nexcessnet/Turpentine/misc/version-4.vcl +++ b/app/code/community/Nexcessnet/Turpentine/misc/version-4.vcl @@ -102,14 +102,6 @@ sub generate_session_expires { {{generate_session_end}} ## Varnish Subroutines -sub vcl_synth { - if (resp.status == 750) { - set resp.status = 301; - set resp.http.Location = "https://" + req.http.host + req.url; - return(deliver); - } -} - sub vcl_init { {{directors}} }