I am trying to get a secure url like this:

$this->storeManager->getStore()->getUrl('someurl', ['_secure' => 'true']);

I still get an insecure url with http://...

What am I doing wrong?

1 Answer 1


I'm pretty _secure only works if the URL natively supports HTTPS.

In case it does not (which seems to be your case as your code is totally valid) you can force it using _forced_secure:

$this->storeManager->getStore()->getUrl('someurl', ['_secure' => true, '_forced_secure' => true]);

Also you were casting true to a string 'true' I'm not sure if it's the reason but I changed that in the code I posted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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