How to Modify the Request Path in a Node Express Proxy? Need Help with 'node express proxy change request path'!

20 Replies, 1660 Views

Hmm, I’ve been there. For node express proxy change request path, I’d recommend sticking with `http-proxy-middleware`. It’s lightweight and does the job well.

If you’re looking to strip a part of the path, use `pathRewrite`. For example:

```javascript
pathRewrite: { '^/remove-this': '' }
```

This will remove `/remove-this` from the path. If you need to add a prefix, just map it to the desired path.

Also, if you’re feeling adventurous, you can write a custom middleware to modify the path before proxying. But honestly, `http-proxy-middleware` should cover most use cases.

Messages In This Thread



Users browsing this thread: 1 Guest(s)