Page 1 of 2

Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 2:27 pm
by Dan Cole
I'm getting close, or at least closer, to migrating my 1.0.5.0 Phoenix Shop to 1.0.8.20 using PHP 8.1 and just discovered a problem on my 1.0.8.20 shop when I have items in my shopping cart and haven't yet logged in. If I click on the Checkout Button in the Shopping Cart page it takes me to the login page via a redirect from checkout shipping...for some reason that results in the TOO-MANY-REDIRECTS issue as can be seen in the Chrome network tool. A screeen shot is attached. Thanks to Matt for pointing out the use of that Chrome tool in trouble shooting a different TOO-MANY-REDIRECTS issue otherwise I think I would have spent way to much time thinking this was a cookie issue as suggested by Firefox.

In trying to trouble shoot this I tested logging in when I have an item in my shopping cart using the login option from the NavBar My profile dropdown list and that seems to take me directly to the login page and things work as expected. I have Rainers Shipping estimator installed on the Shopping Cart page where I also have the Checkout Button and if I login using his Shipping Estimator Login button things also work as expect as well. Both take me directly to the login page without the redirect from checkout shipping. While the TOO-MANY-REDIRECTS issue might be caused by some other problem I'm thinking that the redirect to the login page via the checkout shipping page using the Checkout button is causing the problem but that is just pure speculation on my part.

I'm at a bit of a lost as to where I should go from here....if anyone has any suggestions I'd welcome them.

Dan
chrome network.jpg

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 2:46 pm
by burt
I remember having a similar problem and it turned out that the configure.php file was incorrect, but I can't remember exactly the fix.

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 3:20 pm
by Dan Cole
In case it helps here is what my shop side config file looks like...

error_reporting(E_ALL);

const HTTP_SERVER = 'https://fishfoods.ca';
const COOKIE_OPTIONS = [
'lifetime' => 0,
'domain' => 'fishfoods.ca',
'path' => '/PhoenixCart/',
'samesite' => 'Lax',
'secure' => true,
];
const DIR_WS_CATALOG = '/PhoenixCart/';

date_default_timezone_set('America/New_York');

Dan

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 4:22 pm
by raiwa
Just to be sure: you are not using my 2 page checkout addon?

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 4:34 pm
by Dan Cole
raiwa wrote: Thu Jul 18, 2024 4:22 pm Just to be sure: you are not using my 2 page checkout addon?
Not on my 1.0.8.20 shop but I do use it on my 1.0.5.0 site.

Dan

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 4:44 pm
by burt
When I visited fishfoodS.ca it redirected me to fishfood.ca (note no S), then back to fishfoodS.ca

That might be part of the problem ?

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 6:15 pm
by Dan Cole
burt wrote: Thu Jul 18, 2024 4:44 pm When I visited fishfoodS.ca it redirected me to fishfood.ca (note no S), then back to fishfoodS.ca

That might be part of the problem ?
You have keen eyes Gary...I needed my cheats to see that. I tried fixing it via the cpanel but it won't allow me to do that so I sent a note to the host and asked for that to be sorted...as soon as it is, I'll test again and see if it helps. In either case I'll report back. Thanks for checking it and for the idea.

Dan

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 7:44 pm
by Dan Cole
When I visited fishfoodS.ca it redirected me to fishfood.ca (note no S), then back to fishfoodS.ca

That might be part of the problem ?
The "s" issue has been sorted but unfortunately the TOO_MANY_REDIRECTS issue persists.

Dan

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Thu Jul 18, 2024 9:20 pm
by Dan Cole
Found it....it is caused by this hook that we added to bypass the shipping page when shipping was already selected using the shipping estimator.

Code: Select all

class hook_shop_checkout_shipping_skipShipping {

  public function listen_injectRedirects() {
   //[list] $_SESSION['shipping'] = false;[/list]
   // $_SESSION['sendto'] = false;
    Href::redirect($GLOBALS['Linker']->build('checkout_payment.php'));
  }

}
I assume it needs some kind of condition so it doesn't try to skip the shipping page if it is not set. Perhaps $_SESSION['shipping'] is set to true when set and can be used for that purpose.

Dan

Re: Trouble Shooting - ERR_TOO_MANY_REDIRECTS

Posted: Fri Jul 19, 2024 4:04 am
by raiwa
You should use the 2 page checkout which handles it.