I was also very upset about the same issue. I sent an ajax request from the ssl page as follows:
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
<script type="text/javascript"> $.ajax({ url: "<?php echo $protocol.$_SERVER['HTTP_HOST'].$this->url(array("action"=>"autocomplete", "controller"=>"ajax", "module"=>"default"));?>", data: { term: $("#keyword").val()}, dataType: "json", type: "POST", success: function(data){ response(data); } }); </script>
The problem was that the request header indicates that the reference page is an ssl page, but the response header shows the location of the http page, as in the Rob code graphic above.
I found out that every time you make an ajax request from a response to an ssl page, you get to the same page, that is, an ssl page, and when you make an ajax request from a page other than ssl, the answer will be the same, as a non-ssl page. This is the default rule for ajax request and response.
I think that there should definitely be a problem on the part of my code that forces me to respond to HTTP from the moment of sending from https. Precisely, my suspicion was correct. Actually there was a default code that forces redirecting the response to the http page instead of https. I am using the previous code:
class Custom_Customplugins extends Zend_Controller_Plugin_Abstract { public function preDispatch(Zend_Controller_Request_Abstract $request) { $action = $request->getActionName(); $controller = $request->getControllerName(); $module = $request->getModuleName(); $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $host = $_SERVER['HTTP_HOST']; if($host != "www.xyz.com") { if($protocol == "http://") { } } else { $r = new Zend_Controller_Action_Helper_Redirector(); $u = new Zend_Controller_Action_Helper_Url(); if( ($action == "index" && $controller == "index" && $module == "default") || ($action == "login" && $controller == "index" && $module == "default") || ($action == "businessownerregistration" && $controller == "index" && $module == "default") || ($action == "customerregistration" && $controller == "index" && $module == "default") || ($action == "index" && $controller == "changepwd" && $module == "admin") || ($action == "index" && $controller == "businessowner" && $module == "businessowner") || ($action == "changepwd" && $controller == "serviceprovider" && $module == "businessowner") || ($action == "index" && $controller == "customer" && $module == "default") ) { if($protocol == "http://") { $r->gotoUrl('https://'.$host.$u->url(array("action"=>$action, "controller"=>$controller, "module"=>$module)))->redirectAndExit(); } } else { if($protocol == "https://") { $r->gotoUrl('http://'.$host.$u->url(array("action"=>$action, "controller"=>$controller, "module"=>$module)))->redirectAndExit(); } } } } }
After correction, the code:
<?php class Custom_Customplugins extends Zend_Controller_Plugin_Abstract { public function preDispatch(Zend_Controller_Request_Abstract $request) { $action = $request->getActionName(); $controller = $request->getControllerName(); $module = $request->getModuleName(); $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $host = $_SERVER['HTTP_HOST']; if($host != "www.xyz.com") { if($protocol == "http://") { } } else { $r = new Zend_Controller_Action_Helper_Redirector(); $u = new Zend_Controller_Action_Helper_Url(); if( ($action == "index" && $controller == "index" && $module == "default") || ($action == "login" && $controller == "index" && $module == "default") || ($action == "businessownerregistration" && $controller == "index" && $module == "default") || ($action == "customerregistration" && $controller == "index" && $module == "default") || ($action == "index" && $controller == "changepwd" && $module == "admin") || ($action == "index" && $controller == "businessowner" && $module == "businessowner") || ($action == "changepwd" && $controller == "serviceprovider" && $module == "businessowner") || ($action == "index" && $controller == "customer" && $module == "default") ) { if($protocol == "http://") { $r->gotoUrl('https://'.$host.$u->url(array("action"=>$action, "controller"=>$controller, "module"=>$module)))->redirectAndExit(); } } else if( ($action == "autocomplete" && $controller == "ajax" && $module == "default") || ($action == "refreshcaptcha" && $controller == "index" && $module == "default") ) { } else { if($protocol == "https://") { $r->gotoUrl('http://'.$host.$u->url(array("action"=>$action, "controller"=>$controller, "module"=>$module)))->redirectAndExit(); } } } } } ?>
and now my https page is working fine