I need to put a check on IP. I want to use SSL/https only for my IP.

Where is the method that forms baseUrl with https or http? Where can I do this?

  • not method is available at magento which set set https only for one IP. – Amit Bera Apr 14 '15 at 19:45

The whole config is being loaded pretty early on in the app run and there are no events being dispatched related to this. I think the best way you could do this, is by hooking into the earliest event being dispatched, which would be controller_front_init_before (according to this).

So you would need to write an event observer and in this observer you could manually set the config for secure/SSL.

You'll need to configure a valid secure base URL and set use_in_frontend to "No" (= 0). Then in this observer you can change this on the fly for certain IP addresses:

if ($_SERVER['REMOTE_ADDR'] == '') {
    Mage::app()->getStore()->setConfig('web/secure/use_in_frontend', '1');

You can enable the secure url in admin panel.

Admin > System > Configuration > Web > Secure Url

Give Secure Url in the respected fields and enable SSL for frontend.

  • I now this. But I want to set https only for my IP – omelandr Apr 14 '15 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.