Skip to content

Unable to generate unsecure URL if current URL is secure #6175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Marko-M opened this issue Aug 16, 2016 · 10 comments
Closed

Unable to generate unsecure URL if current URL is secure #6175

Marko-M opened this issue Aug 16, 2016 · 10 comments
Assignees
Labels
bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@Marko-M
Copy link
Contributor

Marko-M commented Aug 16, 2016

Preconditions

  1. Magento 2 version 2.1.0
  2. Use \Magento\Framework\Url::getUrl() from secure area of the store

Steps to reproduce

  1. Make sure code is executed in secure area of the store (HTTPS)
  2. Generate URL in code
    /**
     * @var \Magento\Framework\Url
     */
    protected $url;
...
    $this->url->getUrl(
        'test/test/test',
        [
            '_secure' => false
        ]
    )
  1. Resulting URL is https://example.com/test/test/test

Expected result

  1. Make sure code is executed in secure area of the store (HTTPS)
  2. Generate URL in code
    /**
     * @var \Magento\Framework\Url
     */
    protected $url;
...
    $this->url->getUrl(
        'test/test/test',
        [
            '_secure' => false
        ]
    )
  1. 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.

@piotrekkaminski
Copy link
Contributor

Thank you for your submission.

We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues.

Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).

We are closing this GitHub ticket and have moved your request to the new forum.

@Marko-M
Copy link
Contributor Author

Marko-M commented Aug 25, 2016

Hi @piotrekkaminski, thanks for status update.

But I'm not sure why is this one marked with an improvement tag when it's about already implemented feature, the _secure switch to \Magento\Framework\Url::getUrl whose functionality breaks under described circumstances aka a bug.

@qwerty7869
Copy link

I am also facing the same issue. Is this issue had been fixed?

@Marko-M
Copy link
Contributor Author

Marko-M commented Feb 15, 2017

Marked as feature/improvement request therefore closed. Nevertheless still an issue within Magento 2.1.4 codebase:

https://github.com/magento/magento2/blob/2.1.4/lib/internal/Magento/Framework/Url.php#L364-L366

@qwerty7869
Copy link

Ok, but in feature/improvement request also it is not resolved. This is a very disappointment thing that such a basic functionality is also not working.

@maksek maksek added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report and removed improvement moved_to_forums labels Feb 15, 2017
@maksek
Copy link
Contributor

maksek commented Feb 15, 2017

Internal ticket MAGETWO-62500

@maksek maksek reopened this Feb 15, 2017
@qwerty7869
Copy link

Please can anyone tell me how to check the status of internal ticket created MAGETWO-62500.

@arshadpkm
Copy link
Contributor

I will check this

arshadpkm pushed a commit to arshadpkm/magento2 that referenced this issue Jul 8, 2017
arshadpkm pushed a commit to arshadpkm/magento2 that referenced this issue Jul 8, 2017
arshadpkm pushed a commit to arshadpkm/magento2 that referenced this issue Jul 8, 2017
magento-team pushed a commit that referenced this issue Jul 14, 2017
…re URL if current URL is secure #10188

 - Merge Pull Request #10188 from arshadpkm/magento2:issue-6175
 - Merged commits:
   1. e1bc624
   2. 2e6a202
   3. 839ea2f
magento-team pushed a commit that referenced this issue Jul 14, 2017
…re URL if current URL is secure #10188

 - changed flag to _secure_forced to be consistent with previous implementation
magento-team pushed a commit that referenced this issue Jul 14, 2017
…re URL if current URL is secure #10188

 - changed flag to _secure
magento-team pushed a commit that referenced this issue Jul 14, 2017
…re URL if current URL is secure #10188

 - added integration tests
magento-team pushed a commit that referenced this issue Jul 14, 2017
…re URL if current URL is secure #10188

 - fixed ingration test
magento-team pushed a commit that referenced this issue Jul 14, 2017
@magento-team magento-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report labels Jul 31, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-70591

@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-70736

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Sep 11, 2017
magento-engcom-team pushed a commit that referenced this issue Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

9 participants