I'm starting to get familiar with Magento 2.
I installed v2.3.1 in an Nginx/PHP-fpm and got it working, including the sample data.
Then I followed everything in the tutorial at https://devdocs.magento.com/guides/v2.3/ext-best-practices/extension-coding/example-module-adminpage.html
The menu shows up ok, but when I click the link generated in the menu:
I get the Too many redirects and tries to redirect to:
All other pages, frontend and backend, work fine.
I'm trying to debug this error and found that the the rewrite/redirect is not from Nginx it self.
validate (called from
lib/internal/Magento/Framework/App/FrontController.php) when I try to access the new module the
$action is instance of
Magento\Framework\App\Action\Forward\Interceptor, which fails the test for not being instance of
AbstractAction and start the redirect. But other pages (for example trying to access Content -> Pages) are instance of
Magento\Cms\Controller\Adminhtml\Page\Index\Interceptor that pass that test.
$this->requestValidator->validate($request, $actionInstance) throws an Exception "Invalid request received" for my custom module. And Null in other pages from Magento.
matchAction $modules finds the correct module
MyCompany_ExampleAdminNewPage and the cms page finds the
Then i found that in the same
matchAction, magento didn't retrieve any actionList for the custom module. Which led me to conclude something should be wrong wih my
app/code/MyCompany/ExampleAdminNewPage/Controller/Adminhtml/HelloWorld/Index.php. So i deleted and created a new one, checked for correct file permissions and ownership, and it solved my problem. Could also be the file encoding messing something up (wouldn't be the first, and won't be the last time this will happen).