New feature: enhance security with custom admin URL. #4264
+42
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description (*)
Ref #1209 (comment), where I was trying to make use of the nginx config for admin without the use of caddy. For this, I needed the ability to have a custom admin URL, which is configurable here:
However, Custom Admin URL is not implemented. This PR is my attempt to complete the implementation.
When Custom Admin URL is used, frontend access to admin is forbidden in the function
match()
in app/code/core/Mage/Core/Controller/Varien/Router/Admin.php. This is independent of server config, which provides an alternate way:magento-lts/dev/openmage/nginx-frontend.conf
Lines 150 to 154 in 5a95706
Related Pull Requests
PR #1209
Manual testing scenarios (*)
admin.example.com/adminFrontName
whereadminFrontName
is set in /etc/local.xmlwww.example.com/adminFrontName
should return 404 page not found.Questions or comments
I am not sure if this is the best way to implement the custom admin URL. Collab welcome.
Possible issue for API in 3rd-party code because of
magento-lts/api.php
Line 38 in 5496d8a
As can be seen above, API is admin store, and if there is a
Mage::getUrl()
in the response params, the URL will not be accessible. There is noMage::getUrl()
in the core, but may be present in 3rd-party code/modules.