Question

I am testing my own module on Magento CE 2.2.0 but keep getting "The page isn’t redirecting properly". Looking at the network traffic I see these requests:

  • /magento22-acumulus/admin/
  • /magento22-acumulus/admin/admin/index/denied/
  • /magento22-acumulus/admin/admin/auth/login/
  • /magento22-acumulus/admin/admin/
  • /magento22-acumulus/admin/admin/index/denied/
  • /magento22-acumulus/admin/admin/auth/login/
  • /magento22-acumulus/admin/admin/
  • /magento22-acumulus/admin/admin/index/denied/
  • /magento22-acumulus/admin/admin/auth/login/
  • /magento22-acumulus/admin/admin/
  • ...

My setup:

  • local install on base url /magento22-acumulus/
  • Wampserver 3.0.8 with php 7.0.10 and Apache 2.4.23

What I did:

  • install Magento 2.2.0 with sample data
  • settings changed: remove secret key and use standard admin/ url
  • tested it: I do get the login screen
  • install my module, module:enable, setup:upgrade, setup:di:compile
  • tested it: error as above
  • module:disable, cache:clean, setup:di:compile
  • tested it: I do get the login screen
  • repeated this a number of times, same pattern, so I was thinking it had to do with my module.
  • But then I got my module working once and I was able to go to my own pages. Unfortunately the error came back, so I continued to do some debugging enabling and disabling my module but could not locate the problem
  • and now I also get the problem without my module enabled. So I think it is some strange condition/bug in Magento itself.

What could be the problem here?

No correct solution

OTHER TIPS

I'm not sure whether this is a bug with the compilation process or something wrong with the module code. In my case, Magento compilation was incorrectly creating an interceptor for a class on my module (without an actual defined constructor) which extended another class of another module which extended a class from core Magento (both with defined constructors). This was also creating a blank page in the frontend, besides the problems you mentioned. After several fresh installs of Magento 2.2 and also Magento 2.1 with the same problem this worked for me:

  • Enable developer mode: php bin/magento deploy:mode:set developer
  • Install your module (upload/copy files) then run php bin/magento setup:upgrade
  • Instead of running the compilation process (only needed when the order of constructor arguments is changed or the argument types are changed), just delete the folder /generated/code/YOURMODULENAMESPACE

Since you are using Apache, i suggest you should enable the RewriteLog . Then replicate issue and check logs again.

RewriteLog "logs\rewritelog.txt"    
RewriteLogLevel 3

Last week, I tried again to install a clean M2.3.4 environment (with sample data) and, hoora, it seems to work. Except, after doing a setup:di:compile this problem appeared again. However, removing the generated code from /generated/code made it work again... So it could be a problem in the generator, or some code that checks for the type of an object and does not cater for the generated interceptor classes...

@Gabriel MdS answered more or less the same thing, but for me it also happened when my own module was not yet installed, so I only had the clean install with sample data.

So, not a definitive answer or solution, but, certainly together with @Gabriel MdS's answer, a strong hint towards the generating process.

I know this is an old tread but it ranked first in my Google search. None of these answers helped me but I experience the same issue and was able to solve it. My setup uses a reverse proxy. Behind the proxy I use http (non-ssl) and before the proxy only https (ssl) is allowed. This caused my redirect problem.

Solution: add the following line (right after the comments) to pub/index.php

$_SERVER['HTTPS']='on';

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top