Redirect loop wrong detection (service unavailable: RedirectLoopException)

Created on 15 November 2023, about 1 year ago
Updated 11 September 2024, 3 months ago

Problem/Motivation

I found the module is using the value in redirect_source__path for detection of infinite loops:

excerpt from the redirect table:

5342,redirect,8c5eceb5-14a1-4c6a-869f-b42a05cafac2,und,k6wPRoRC6ccu0Zy5tzPW19liMzMStXWUs__gCjQFJOI,9797,blog/2014/07/questions_to_ask_your_potential_roommate,N;, internal:/node/40665

5356,redirect,4345ba2a-fc59-4032-9ff1-917640ebd9f0,und,n7HCixTHQLGqkMoVQLQVxkrcSQ7UWH0Copmvm3qi6DY,9797,rent/questions_to_ask_your_potential_roommate,N;, internal:/node/40665

So when first url is entered: "/blog/2014/07/questions_to_ask_your_potential_roommate", it finds the second one. When it finds the second one, it loads its redirect_source__path (/rent/questions_to_ask_your_potential_roommate) and tries to find the redirect using this URL.

It finds the same row again and since its id is already in the history ($this->foundRedirects) it throws the exception that infinite loop was detected.

In the patch here I added a check for that, which resolved very stubborn redirect issues on our website. Now when first url is entered, it is successfully redirected to the second one.

Maybe it will free up some time if anyone has the same issues.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇸🇮Slovenia Aleksander Belov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024