Answer the question
In order to leave comments, you need to log in
Why is "localhost redirected too many times"?
Hello, I decided to write a site where you need to have an admin panel of the site. But here's the problem, everything was fine until it came to checks for having cookies. On swag, I found a piece of code that checks all incoming requests. That is, if there are cookies, then the next() function is called , and if there are none, then a redirect to the page with authorization. But for some reason, redirection does not work if you go to the address "/admin/..", "/admin/settings/" - for example.
Code:
Could you explain what the problem is and tell more about its solution? Thank you.
Answer the question
In order to leave comments, you need to log in
The user comes to admin/login to register. And there your piece of code works, it looks to see if there are cookies, there are no cookies, so we send the user to admin/login. The user goes to admin/login to register. And there your piece of code works, it looks to see if there are cookies, there are no cookies, so we send the user to admin/login. The user goes to admin/login to register. And there your piece of code works, it looks to see if there are cookies, there are no cookies, so we send the user to admin/login. The user goes to admin/login to register. And there your piece of code works, it looks to see if there are cookies, there are no cookies, so we send the user to admin/login. User comes to admin/login ....
.... time passes ...
the browser gets bored with all this and stops this fun process.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question