Magento admin does not work when a port number is included in the URL. Gets stuck in redirect loop.
Issue Summary
Using a custom port during Magento installation causes the admin page to be inaccessible. Browser gets stuck in a redirect loop.
Preconditions
- Magento 2.3.0
- Ubuntu 18.10 Server
- Apache 2.4.37
- MySQL Community Server 8.0.13
- PHP-FPM 7.2.13
Steps to reproduce
- Set web server to listen on a custom port, such as 8899
- Download and unpack Magento 2.3.0 from Github releases page: https://github.com/magento/magento2/releases
- Create the database and user, and assign that user to the database with the required permissions.
- Visit the URL to the unpacked directory, such as http://example.com:8899/magento2-2.3.0/
- Proceed through installation until Step 3: Web Configuration. "Your Store Address" is incorrectly set since it does not have the port number included in the URL. Change it to include the port number. http://example.com/magento2-2.3.0/ becomes http://example.com:8899/magento2-2.3.0/
- Complete installation
- Visit the admin URL, such as http://example.com:8899/magento2-2.3.0/admin_8x487z
Expected result
Magento admin login page should be displayed
Actual result
Browser is stuck in a "ERR_TOO_MANY_REDIRECTS" loop. Message given (in Chrome) is:
This page isn't working
example.com redirected you too many times. Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
Additional Notes
- Accessing the frontend of the site at http://example.com:8899/magento2-2.3.0/ works fine.
- Installing without a port number included (eg. http://example.com/magento2-2.3.0/) works fine. That said, I don't have that option and need to include a port number in the URL.
- I have tried multiple browsers (with cookies cleared), changing options in the database (base_url, use_in_frontend, use_in_adminhtml, cookie_domain, etc) and have cleared the Magento cache. Nothing works unless the port number is removed from the URL.
- Definitely seems like a bug that needs to be fixed.
Hi @Jammmmm. 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-engcom-team give me $VERSION instance
where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.
@Jammmmm do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
- [ ] yes
- [ ] no
Hi @Jammmmm. Thank you for your report. To help us process this issue please make sure that you provided the following information:
- [x] Summary of the issue
- [x] Information on your environment
- [x] Steps to reproduce
- [x] Expected and actual results
All of the above has been provided.
@Jammmmm do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
- [x] yes
- [ ] no
Yes.
Hi @milindsingh. 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: :point_down:
-
[x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears. -
[x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself. -
[x] 3. Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.3-developbranchDetails
- Add the comment@magento-engcom-team give me 2.3-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.3-developbranch, please, add the labelReproduced on 2.3.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. Verify that the issue is reproducible on
2.2-developbranch.Details
- Add the comment@magento-engcom-team give me 2.2-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.2-developbranch, please add the labelReproduced on 2.2.x -
[ ] 6. Add label
Issue: Confirmedonce verification is complete. -
[ ] 7. Make sure that automatic system confirms that report has been added to the backlog.
@Jammmmm I am not able to reproduce in 2.3.
Hi,
As @Jammmmm reported, I have been experiencing problem accessing a similar problem. I am however using Magento 2.4.2 and loaded with bin/magento sampledata:deploy.
The browser (Firefox or Chrome) goes into an "endless" redirect loop (~20) before the browser notices the pattern and stops making the same request. The issue started after I added non-standard port 8443 to the base URLs of my HTTPS requests. As long as the standard port is used and therefore not included on the URL, the admin pages are render fine. With port 8443, the redirect error appears. Unfortunately for my use case, the port needs to be defined something other than the standard 443.
Portions of core_config_data table:
| config_id | scope | scope_id | path | value | updated_at |
|---|---|---|---|---|---|
| 32 | default | 0 | admin/url/custom | https://ddev-magento2.ddev.site:8443/ | 2021-04-20 18:10:24 |
| 31 | default | 0 | admin/url/use_custom | 1 | 2021-04-20 17:11:12 |
| 23 | default | 0 | admin/usage/enabled | 1 | 2021-04-19 13:45:15 |
| 30 | default | 0 | web/secure/base_url | https://ddev-magento2.ddev.site:8443/ | 2021-04-20 18:10:49 |
| 33 | stores | 0 | web/secure/base_url | https://ddev-magento2.ddev.site:8443/ | 2021-04-20 18:10:59 |
| 4 | default | 0 | web/unsecure/base_url | https://ddev-magento2.ddev.site:8443/ | 2021-04-20 18:11:09 |
| 34 | stores | 0 | web/unsecure/base_url | https://ddev-magento2.ddev.site:8443/ | 2021-04-20 18:11:25 |
AdvThanksance!!!