Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The page isn’t redirecting properly Nginx

Tags:

php

nginx

I am getting

"The page isn’t redirecting properly"

while accessing my website. It was working fine a few hours before but after pulling updated code it starts showing me

"The page isn’t redirecting properly, Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

I did not change any kind of configuration in Nginx. My website is simply a php website.

like image 839
Rishabh Agrawal Avatar asked Aug 06 '18 13:08

Rishabh Agrawal


Video Answer


1 Answers

This error usually pops up when you accidentally have a series of rewrite directives that cause an infinite redirect loop, or if your PHP code is sending bad HTTP redirects that are causing an infinite loop.

You can debug the issue by doing the following in your browser:

  1. Open a new tab.
  2. Open your Developer Tools (in chrome, Ctrl+Shift+I) and switch to the "Network" tab.
  3. Click "Preserve log" so that your request history is not lost on each redirect.
  4. Load the URL that is redirecting infinitely in your browser.
  5. Look at the requests being made in the "Network" tab to identify what URLs nginx or PHP is sending back to the browser as redirects. By seeing the actual URLs your browser is trying to visit, you can usually identify the logic error that is causing the infinite loop.
like image 192
Zach Bloomquist Avatar answered Oct 03 '22 20:10

Zach Bloomquist