I was also very upset regarding the same problem. I was sending the ajax request from my 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, request header shows that the referer page is an ssl page but the response header shows the location an "http" page as in above Rob's code printscreen.
I came to know that each and every time when you make an ajax request from an ssl page response came to the same page i.e. for ssl page and when you make the ajax request from non-ssl page by the response will came for the same i.e. non-ssl page. This is the default rule for ajax request and response.
I think, definitely there must be a problem from my code side which force to make response from http while sending from https.
Exactally, my suspicion was right. Actually there was a default code which force to redirect to response to http page instead of https.
I am sharing 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 is:
<?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