Difference between req.url and req.originalUrl in Express.js version 4

From the Express.js documentation:

req.url is not a native Express property, it is inherited from
Node’s http
module.

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.

In other words, req.url might be overwritten during the internal routing, while req.originalUrl will remain untouched.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)