Skip to content
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

Custom Admin Domain and Internal Redirects #28943

Closed
1 of 5 tasks
pocallaghan opened this issue Jun 30, 2020 · 15 comments · Fixed by #29066
Closed
1 of 5 tasks

Custom Admin Domain and Internal Redirects #28943

pocallaghan opened this issue Jun 30, 2020 · 15 comments · Fixed by #29066
Assignees
Labels
Component: UrlRewrite Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.0 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround. Triage: Done Has been reviewed and prioritized during Triage with Product Managers

Comments

@pocallaghan
Copy link
Contributor

pocallaghan commented Jun 30, 2020

The logic that checks if a redirect is "internal" is broken in the admin panel when using a custom admin domain, which causes a wide variety of admin redirects to redirect you to the homepage of the default store.

The issue is due to Magento\Store\App\Response\Redirect::_isUrlInternal using the default stores base url. When in the adminhtml area, this method should respect the config options admin/url/use_custom and admin/url/custom.

Preconditions (*)

  1. Magento 2.4-develop
  2. Custom admin domain set under Stores > Configuration > Advanced > Admin > Admin Base Url > Custom Admin Url
    image
  3. For local environment: Create additional virtualhost for url http://admin.magento2dev.loc and add admin.magento2dev.loc to hosts file
<VirtualHost *:80>
    ServerName          magento2dev.loc
    ServerAlias magento2dev.loc
    DocumentRoot        /var/www/html/magento2dev
<Directory /var/www/html/magento2dev/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
Require all granted
</Directory>
 </VirtualHost>


<VirtualHost *:80>
    ServerName          admin.magento2dev.loc
    DocumentRoot        /var/www/html/magento2dev
<Directory /var/www/html/magento2dev/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
Require all granted
</Directory>
 </VirtualHost>

Steps to reproduce (*)

  1. Log in to an account with access to URL Rewrites
  2. Navigate to Marketing > URL Rewrites
  3. Click Add Url Rewrite
  4. Enter 123456789 as the request path and 987654321 as the target path, then hit save.
  5. Click Add Url Rewrite again
  6. Enter 123456789 as the request path and xyz as the target path, then hit save.

Expected result (*)

  1. Expected to be redirected back to the URL Rewrite Edit page with an error message Request Path for Specified Store already exists.

Actual result (*)

  1. You're redirected to the homepage of the default store.
    Peek 2020-07-07 13-21

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Jun 30, 2020

Hi @pocallaghan. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


@ghost ghost added this to Ready for QA in Community Backlog Jun 30, 2020
@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Jun 30, 2020
@engcom-Lima engcom-Lima self-assigned this Jul 2, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jul 2, 2020

Hi @engcom-Lima. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Lima
Copy link
Contributor

Hello @pocallaghan

Could you confirm that the result will be the same as when using the CLI?
php bin/magento setup:config:set --backend-frontname="newadminpath"
Where newadminpath - new Custom Admin URL
I checked on the Magento 2.4 using CLI and cannot reproduce the issue

@pocallaghan
Copy link
Contributor Author

That is not the same setting, you're setting the "frontname", not the domain name.

@engcom-Lima
Copy link
Contributor

engcom-Lima commented Jul 3, 2020

Hello @pocallaghan
Could you show how are you configure Custom admin domain under Stores > Configuration > Advanced > Admin > Admin Base Url > Custom Admin Url?
It would be great if you attached the GIF file.
I checked versions 2.4, 2.3.5 and 2.3.4-p2 and every time I got an error

@sunel
Copy link

sunel commented Jul 3, 2020

@engcom-Lima

This is long pending issue #12354

@pocallaghan
Copy link
Contributor Author

@engcom-Lima you're likely to be unable to replicate in what ever environment you're trying it in. Changing the domain name of the admin panel requires DNS entries to be added so that the domain name you enter points at the same location as the main stores domain and potentially updates to the server hosting configuration so that the domain loads the right VirtualHost. @sunel it is indeed the same issue, but the ticket was marked as non-issue with no good reason. It is 100% an issue.

@m2-assistant
Copy link

m2-assistant bot commented Jul 7, 2020

Hi @engcom-Delta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Delta engcom-Delta added Component: UrlRewrite Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Jul 7, 2020
@ghost ghost unassigned engcom-Delta Jul 7, 2020
@ghost ghost moved this from Ready for QA to Ready for Dev in Community Backlog Jul 7, 2020
@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jul 7, 2020
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Delta
Thank you for verifying the issue. Based on the provided information internal tickets MC-35680 were created

Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Charlie engcom-Charlie self-assigned this Jul 7, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jul 7, 2020

Hi @engcom-Charlie. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

    1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

@engcom-Lima engcom-Lima removed their assignment Jul 8, 2020
@HenKun
Copy link

HenKun commented Jul 9, 2020

This issue also arises, when the default store domain has a subfolder like https://www.example.com/en-us/.
Then in _isUrlInternal() the check fails because https://www.example.com/admin/... does not contain https://www.example.com/en-us/. It's the same reason.

@ghost ghost moved this from Ready for Dev to PR In Progress in Community Backlog Jul 10, 2020
@ihor-sviziev ihor-sviziev added Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Severity: S1 Affects critical data or functionality and forces users to employ a workaround. and removed Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Jul 10, 2020
@engcom-Alfa engcom-Alfa added Triage: Ready for Triage Issue is ready to me triaged with Product Manager Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Triage: Done Has been reviewed and prioritized during Triage with Product Managers and removed Triage: Ready for Triage Issue is ready to me triaged with Product Manager labels Jul 21, 2020
@engcom-Alfa
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @engcom-Alfa. Thank you for your request. I'm working on Magento 2.4-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @engcom-Alfa, here is your Magento instance.
Admin access: https://i-28943-2-4-develop.instances.magento-community.engineering/admin_492c
Login: 0388e944 Password: d6a6f1c51ae8
Instance will be terminated in up to 3 hours.

@magento-engcom-team
Copy link
Contributor

Hi @pocallaghan. Thank you for your report.
The issue has been fixed in #29066 by @engcom-Charlie in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.1 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jul 29, 2020
@ghost ghost moved this from PR In Progress to Done (last 30 days) in Community Backlog Jul 29, 2020
@magento-engcom-team magento-engcom-team added the Reported on 2.4.0 Indicates original Magento version for the Issue report. label Nov 13, 2020
@m2-community-project m2-community-project bot removed this from Done (last 30 days) in Community Backlog Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: UrlRewrite Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.0 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround. Triage: Done Has been reviewed and prioritized during Triage with Product Managers
Projects
Development

Successfully merging a pull request may close this issue.

9 participants