Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How/where is it determined whether a page is served as secure or insecure? 
 
gabrielk
Sr. Member
 
Avatar
Total Posts:  83
Joined:  2007-11-30
 

We’re using a 3rd party image hosting service, which means when a customer goes to My Account -> My Product Reviews they get hit with a secure/insecure image message.  While it’s possible just to change the protocol for the external image link to https, it got me thinking, how DO you determine whether the page in Magento is being served via http or https?  I dug around the controllers and various xml files and didn’t see anything.

 
Magento Community Magento Community
Magento Community
Magento Community
 
davion
Jr. Member
 
Total Posts:  18
Joined:  2008-05-03
 

Well, I’m not quite sure what exactly you want to get, but to know if current page served via http or https in Magento
you can check it by $this->getUrl(’’); ($this->getAccountUrl()) or some similar function (in .phtml) and then compare it first
characters with http and https…

 
Magento Community Magento Community
Magento Community
Magento Community
 
alistek
Sr. Member
 
Total Posts:  293
Joined:  2008-04-02
Normal, IL
 

There is a function that will serve a url as https or http.  I can’t remember where it is but it is called on certain actions, i.e. in checkout code.

-Adam

 
Magento Community Magento Community
Magento Community
Magento Community
 
Anton Makarenko
Magento Team
 
Avatar
Total Posts:  184
Joined:  2008-05-13
Los Angeles, CA
 

> How/where is it determined whether a page is served as secure or insecure?
in Mage_Core_Model_Url, search by text “[’_secure’]”.
To see examples, open Mage_Customer_Block_Account_Dashboard and look at any func, that generates a secure URL:

public function getAddressEditUrl($address)
    
{
        
return Mage::getUrl('customer/address/edit', array('_secure'=>true'id'=>$address->getId()));
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top