Replies: 9 comments 9 replies
-
Thanks for the beta @chimurai! Is there any expected timeframe for this to become official? |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
First of all, thanks for creating and maintaining this useful middleware! 🙌 We have just started using Here's an example of what we're doing:
|
Beta Was this translation helpful? Give feedback.
-
For what it's worth, we had issues with We proxy requests based on user-specific parameters and the |
Beta Was this translation helpful? Give feedback.
-
Thanks for the release |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
I upgraded to v3 in an Express 4.x and Typescript environment. The only feedback I'd give is that is seems odd to have typed the This is what I'm doing in v3 for Express 4.x which uses const proxyHandler = createProxyMiddleware({
target: 'https://localhost:4444',
});
app.use('/proxy', (req, res, next) => {
proxyHandler(req, res, next)?.catch(next);
}); Obviously not a big deal, I'm only adding |
Beta Was this translation helpful? Give feedback.
-
I just updated to v3. The types import {createProxyMiddleware} from "http-proxy-middleware";
import http from "http";
-import {Request, Response} from "http-proxy-middleware/dist/types";
export const lrFrontendConnector = createProxyMiddleware({
target: 'http://localhost:3001',
changeOrigin: true,
- onProxyRes: (proxyRes: http.IncomingMessage, req: Request, res: Response) => {
- proxyRes.statusCode = 200;
+ on: {
+ proxyRes: (proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => {
+ proxyRes.statusCode = 200;
+ }
}
}); |
Beta Was this translation helpful? Give feedback.
-
V3
Version 3 introduced some breaking changes in order to have a better DX, TypeScript support and extensibility with the new plugin system.
Installation
Install the v3 with
npm install http-proxy-middleware@latest
oryarn add http-proxy-middleware@latest
Migration Guide
Follow MIGRATION.md to transition from v2 to v3.
You can use
legacyCreateProxyMiddleware
as intermediate step. It will tell you run-time which configurations need to migrated:Notable changes
When the proxy is mounted on a server
path
(ie.app.use('/basepath', router)
);basePath
is not included anymore when proxying a request when you configure thetarget
with justprotocol + hostname
. (#731)To include the basePath, you'll have to include the
basePath
in the target. (See example below)To rewrite the basePath, you can simply change the basePath in the target. (You can still use
pathRewrite
to change to thereq.url
)NOTE: Proxy behaviour hasn't changed when you've mounted the proxy in the root path. ie.
app.use(proxy)
🚀 Improved support for different server types
📝 Improved logger
Configuring a logger has been simplified with improved log output:
🐛 Debugging
Enable debugging to see more the verbose internal logging for troubleshooting:
🔌 Plugins
Access low-level http-proxy and create reusable functionality:
http-proxy-middleware ships with some default plugins for the most common use cases. Use
ejectPlugins
to opt-out.📃 Other improvements
plugins
configuration for better extensibility (feat(plugins): add support for plugins #732)ejectPlugins
to opt-out (feat(ejectPlugins): skip registering default plugins #750)DEBUG=http-proxy-middleware*
(feat(debug): improve troubleshooting #752)logger
. Simplified with better logging (refactor: logging [BREAKING CHANGE] #749)legacyCreateProxyMiddleware
to help transitioning from v2 to v3 (feat(legacyCreateProxyMiddleware): show migration tips #756)Change log
Full Changelog:
This discussion was created from the release v3.0.0-beta.0.
Beta Was this translation helpful? Give feedback.
All reactions