chimurai / http-proxy-middleware

:zap: The one-liner node.js http-proxy middleware for connect, express, next.js and more
MIT License
10.76k stars 849 forks source link

fix: server mounting [BREAKING CHANGE] #731

Closed chimurai closed 2 years ago

chimurai commented 2 years ago

Description

Fixes incorrect usage of originalUrl. Introduced in https://github.com/chimurai/http-proxy-middleware/pull/18

Now you can modify the baseUrl; a feature which Express' app.use already provides..

// mount on "/users" and keep the "/users" base path
app.use('/user', createProxyMiddleware({'target': 'https://jsonplaceholder.typicode.com/users'}))

// mount on "/users" and change the "/users" base path
app.use('/user', createProxyMiddleware({'target': 'https://jsonplaceholder.typicode.com/customers'}))

Motivation and Context

How has this been tested?

Types of changes

Checklist:

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.007%) to 98.788% when pulling 91c57154bb95d71bfb3ab28c362ba0531646989f on fix-originalUrl into 8a2e7a6c6db8eb6a91c88e8fb9959e24acc64ca7 on v3.