Solution to Drupal 8 Redirect module causes infinite loop (ERR_TOO_MANY_REDIRECTS) in all the URLs except front page for anonymous user

When I tried to install Drupal 8 Varbase distribution and visited its sub pages as anonymous user (like Login page https://www.webfoobar.com/user/login) I get this error message in my browser:

This page isn’t working

www.webfoobar.com redirected you too many times.

Try clearing your cookies.

ERR_TOO_MANY_REDIRECTS

... and the URL changed to:

  
https://www.webfoobar.com/user/login?q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login&q=user/login
  

The error did not occured in fron page and when logged in as administrator just right after Varbase was installed. I investigated the issue and I found out that the Redirect module causes this infinite loop error.

After some debugging, I finally fixed the error by changing the following nginx configuration lines from:

  
location / {
  try_files $uri $uri/ @indexphp;
}

## Support for clean URL
location @indexphp {
  rewrite ^/(.*)$ /index.php?q=$1 last;
}
  

... to:

  
location / {
  try_files $uri $uri/ /index.php;
}
  

Then clear the cache at http://www.webfoobar.com/admin/config/development/performance or by executing:

  
drush cache-rebuild
  

Comments

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.