req.originalUrl is a string with the original request URL (path + query). It stays stable when Express rewrites req.url for mounting with app.use().
Use it for logging, audits, and redirects that must reflect what the client actually asked for. Inside a mounted stack it lines up with req.baseUrl plus req.url. For the path alone (no query), see req.path.
Syntax
Read req.originalUrl in your Express.js route handler. Start with this line.
Express
req.originalUrl
Call
What it does
req.originalUrl
Primary signature.
Install with npm install express. Create the app with const app = express() before you use this API in an Express.js tutorial project.
Create a router. Routes are defined relative to the mount.
Mount at /admin. Express rewrites req.url for that stack.
Handler sees the split.url/path are relative; originalUrl is not.
JSON makes it obvious. Compare fields side by side in the response.
Compatibility
Runtime Support
req.originalUrl is an Express.js request property. It runs on a Node.js server (Express 5 needs Node.js 18+). Browsers do not execute it — they only send HTTP requests to your app.
✓ Server · Express 4 & 5
req.originalUrl
Works wherever Express runs: Node.js is the primary target. Bun and Deno can run many Express apps with compatibility layers. Not available in the browser.
ServerNode.js runtime API
Node.js18+ for Express 5 · 14+ typical for Express 4
Supported
BunExpress-compatible server apps
Supported
DenoVia npm compatibility / adapters
Supported
req.originalUrlExpress on Node.js
Bottom line: Study and run these examples with Node.js and the express package. Copy a snippet into a local file and start the server with node.
Frequently Asked Questions
It is a string with the original request URL path plus query string, kept even when Express rewrites req.url for mounting.
req.url can be rewritten when you mount middleware or routers (the mount prefix is stripped). req.originalUrl stays as the client originally requested.
Yes. For GET /search?q=something, req.originalUrl is '/search?q=something'.
Inside a mounted stack, req.originalUrl is effectively the combination of req.baseUrl and req.url. req.path is the path part without the query.
No. It is a server-side Express request property. Browsers only send the HTTP request; your app reads originalUrl on the server.