Feature request from Marko-M, posted on GitHub Aug 16, 2016
Preconditions
- Magento 2 version 2.1.0
- Use \Magento\Framework\Url::getUrl() from secure area of the store
Steps to reproduce
- Make sure code is executed in secure area of the store (HTTPS)
- Generate URL in code
/**
* @var \Magento\Framework\Url
*/
protected $url;
...
$this->url->getUrl(
'test/test/test',
[
'_secure' => false
]
)
- Resulting URL is https://example.com/test/test/test
Expected result
- Make sure code is executed in secure area of the store (HTTPS)
- Generate URL in code
/**
* @var \Magento\Framework\Url
*/
protected $url;
...
$this->url->getUrl(
'test/test/test',
[
'_secure' => false
]
)
- Resulting URL is http://example.com/test/test/test
Reason behind such behavior is:
https://github.com/magento/magento2/blob/2.1.0/lib/internal/Magento/Framework/Url.php#L364-L366
where code assumes that if current request is secure, requested url should be secure as well, regardless to '_secure' parameter saying otherwise.