Proxy Community
How to Modify the Request Path in a Node Express Proxy? Need Help with 'node express proxy change request path'![/b - Printable Version

+- Proxy Community (https://proxycommunity.com/forum)
+-- Forum: Proxy Provider Discussions (https://proxycommunity.com/forum/forum-proxy-provider-discussions)
+--- Forum: BrightData (https://proxycommunity.com/forum/forum-brightdata)
+--- Thread: How to Modify the Request Path in a Node Express Proxy? Need Help with 'node express proxy change request path'![/b (/thread-how-to-modify-the-request-path-in-a-node-express-proxy-need-help-with-node-express-proxy-change-request-path-b)

Pages: 1 2


“” - hiddenSeekerX - 12-03-2025

Hey! If you’re looking to dynamically change the request path in a node express proxy, `http-proxy-middleware` is your best bet. Here’s a quick example:

```javascript
const { createProxyMiddleware } = require('http-proxy-middleware');

app.use('/api', createProxyMiddleware({
target: 'http://your-target-server.com',
pathRewrite: function (path, req) {
return path.replace('/api/v1', '/v2');
}
}));
```
This will handle the node express proxy change request path issue easily. Let me know if you run into any problems!