Skip to content

Conversation

@FraBle
Copy link

@FraBle FraBle commented Mar 2, 2018

The current implementation overwrites req.url since it is used in the log message templates.
This leads to errors and issues like #156. In our case, it makes the Express app even crash.

This PR removes the overwrite of req.url and switches to req.originalUrl for the log messages.
It resolves #156.

A little bit more context:
The Express docs explain that req.url should only be changed for explicit desired internal routing purposes.

req.originalUrl

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Middleware resets req.url on res.send() and prevents further middleware to execute

1 participant