-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
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
Option to turn off built in 'back' functionality in res.location('back') #3290
Comments
Hi @WORMSS as for the "It was not expected" comment, I felt like your documentation was pretty good (http://expressjs.com/en/4x/api.html#res.location). How can we improve it? |
Oh, by "not expected" I mean I was expecting the exact result I put it to come out. After seeing the code and reading the docs, I understood why it was there.. But I was using "location" without realising there was special case for the word "back". If it had been something like |
Gotcha, so you're saying that the behavior was expected to treat The reason I'm asking is because we can't change the behavior in 4.x, but I don't want people to not realize what is happening, so want to make sure that our documentation is sufficient such that it is not unexpected behavior. |
As you have said in #3291 if you have the ability to remove the magic back code from 5.x, I would put my vote for that. You could keep the functionality, as I said above, maybe something that just isn't a common word, or something that is a valid referrer.. |
Added tests for res.location('back') Made option to turn off built 'back' referrer functionality when not working the way it was expected. fixes: expressjs#3290
I had spotted there were no tests for
res.location('back')
so I have added them.I came across this because I was trying to navigate to the relative page called 'back' and was being redirected to domain root. It was not expected. After looking at the code I spotted there was a "special" case for the word "back".
The text was updated successfully, but these errors were encountered: