I am familiar with using various methods to generate a secure URL based on context, ie:
$this->getUrl('my-page', array('_forced_secure' => $this->getRequest()->isSecure()));
This works great for building links that will direct to a secure page while you are in secure mode (or will just link to the non-secure page if not using secure mode).
The problem I am looking at is Magento only treats a few special pages as needing to be secure (customer account, checkout, etc). What I would prefer would be to have Magento always use a secure link if the user is currently in secure mode, or use the non-secure link if the user is in non-secure mode.
From what I can tell, my only real options are:
- Modify every instance of
$this->getUrl()to be similar to the snippet above.
- Set non-secure
base_urlto use HTTPS, forcing all pages to secure.
Is there a better method that won't involve having to change every call to
$this->getUrl() or forcing all pages to HTTPS regardless of user's context?
-- edit --
I am aware I can modify
/app/code/core/Mage/Core/Model/Url.php->setRouteParams() method, though I am hoping there is a cleaner way.