Open MooseSaeed opened 1 year ago
Got that sorted out
if (/^.*(%2)$/.test(req.url)) {
res.setHeader('Location', encodeURI(req.url.slice(0, -2)))
res.statusCode = 302
res.end()
} else {
next(error)
}
I'm having an issue where I'm getting a lot of URI Malformed errors on Sentry from routes that are valid but has
%2
at the end of it. So I need a way to remove the%2
whenever there is an error while decoding and redirect the user to that route.How can I redirect the user to a different route onDecodeError?