From the Express.js documentation:
req.url
is not a native Express property, it is inherited from
Node’shttp
module.This property is much like
req.url
; however, it retains the original
request URL, allowing you to rewritereq.url
freely for internal
routing purposes. For example, the “mounting” feature ofapp.use()
will rewritereq.url
to strip the mount point.
In other words, req.url
might be overwritten during the internal routing, while req.originalUrl
will remain untouched.