I have a register form on every page of my website. During registration some error may occur. After catching the error, I have to return the user to the previous page, sho
You should add page parameter to the form. Then you can read it on the server and use it for the redirect.
res.redirect(page, {reg_error:'username'}) // page being the url to redirect to.