question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

avoid redirect loops

See original GitHub issue

Reference: https://github.com/nuxt/framework/pull/3908#issuecomment-1079665687

With redirectTo, it is possible to make a loop condition return navigateTo(to.path).

A simple fix would be check and avoid redirect to exact same URL.

In more complex cases, a redirect loop can be nested like a~>b~>a which we could implement with help of a persisted state. (we can wait for this until having session support and benefit from session to hold such state)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
chenmaolancommented, Dec 8, 2022

@chenmaolan Change your logic. As written that is what is creating the loop. (I don’t know what you are trying to do, or I would make a suggestion, but you never create a condition that will ‘exit’ the loop.

Thanks for your reply, I changed the method, using the state to access the value

0reactions
lixiaofacommented, Dec 8, 2022

@chenmaolan Change your logic. As written that is what is creating the loop. (I don’t know what you are trying to do, or I would make a suggestion, but you never create a condition that will ‘exit’ the loop.

image I don’t know what your exit conditions are, or how I should write them,

This is a normal routing guard logic @danielroe @pi0 @fanqidong @chenmaolan @

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redirect Loops: Why they harm your SEO performance
You need to avoid redirect loops, because they make visitors—and search engines—get stuck on your website. Like this: Redirect loop ...
Read more >
How To Easily Find And Fix Redirect Loops Error in WordPress?
This post will teach you everything about redirect loops and how to find and fix them easily with actionable steps.
Read more >
Avoiding redirect loop - php - Stack Overflow
Make sure that in frontend/pages/maintenance.php you do not redirect to index.php?page=maintenance or you will still get into loops.
Read more >
How to Fix The ERR_TOO_MANY_REDIRECTS Error - Kinsta
Due to the fact that redirect loops are responses that can be cached, it's always recommended to try clearing the cache on your...
Read more >
How to Solve This Webpage has a Redirect Loop Problem
Redirect loop is like a situation wherein “A points to B and B points back to A”. Such a redirection will keep browser...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found