_includes/api/en/5x/req-originalUrl.md
This property is much like req.url; however, it retains the original request URL,
allowing you to rewrite req.url freely for internal routing purposes. For example,
the "mounting" feature of app.use() will rewrite req.url to strip the mount point.
// GET /search?q=something
console.dir(req.originalUrl)
// => "/search?q=something"
req.originalUrl is available both in middleware and router objects, and is a
combination of req.baseUrl and req.url. Consider following example:
// GET 'http://www.example.com/admin/new?sort=desc'
app.use('/admin', (req, res, next) => {
console.dir(req.originalUrl) // '/admin/new?sort=desc'
console.dir(req.baseUrl) // '/admin'
console.dir(req.path) // '/new'
next()
})