Skip to content

Infinite redirect loop with ISG and ODR in edge cases #460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yobottehg opened this issue Mar 13, 2023 · 2 comments
Open

Infinite redirect loop with ISG and ODR in edge cases #460

yobottehg opened this issue Mar 13, 2023 · 2 comments

Comments

@yobottehg
Copy link
Contributor

yobottehg commented Mar 13, 2023

Hei,

i wanted to report a potential bug with redirects integration and incremental static regeneration and on-demand revalidation which results in an infinite redirect loop in the next website.

Steps to reproduce:

  • Have ISG and On-demand revalidation enabled and configured
  • Run the next.js app in production mode (Because ISG is re-done each request on dev mode)
  • Pathauto and redirect need to be configured correctly and the client is adapter like here: https://next-drupal.org/guides/redirects
  • Have a content type with a path auto pattern based on a content field (e.g title) we use here /article/test as an example
  • Change the title from test to test1. A redirect from /article/test to /article/test1 is created in Drupal. Loading /article/test in the client serves a 301 redirect to /article/test1 --> OK
  • Change the title from test1 back to test. The redirect from /article/test to /article/test1 in Drupal is deleted. A Redirect from /article/test1 to /article/test is created. Loading /article/test1 in Drupal works okay. Also the redirect works okay.
  • Loading /article/test in the client leads to an infinite redirect loop. Potentially because the delete of the old redirect did not trigger a revalidation on the client on the old url. So the client now has 2 cached redirects which lead to each other -> Loop

Potential fixes:

  • If the url changed revalidate the old and the new path
  • Revalidate urls also on redirect creation / change
@shadcn
Copy link
Contributor

shadcn commented Mar 23, 2023

@yobottehg Thanks for the detailed instructions. I'll look into this.

@taskrider2022
Copy link

taskrider2022 commented Sep 21, 2023

Any information about this. We have a similar bug.

Drupal user change a site and a auto redirect will be created from the redirect module. But this will not update the next cache. If I disable the auto generate redirect on alias change in the redirect module and create a redirect manual it will work as intended

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants