Zero response through http-proxy-middleware

http-proxy-middleware typescript
http-proxy-middleware multiple targets
express proxy websocket
npm http-proxy
http-proxy-middleware authentication
proxy is not a function http-proxy-middleware
next js http-proxy-middleware
express-http-proxy post

I am trying to debug a proxy in Express, using http-proxy-middleware, but no matter what I do I get absolutely zero response. The endpoint sends the response but it is never returned by the proxy and the onProxyRes event is never triggered. Also the endpoint can be accessed directly through curl, Insomnia, fetch API and request-promise and is in use as an API for our customers.

Even with a setup as simple as:

app.use('/api', proxy({
  target: 'https://my.secret.endpoint',
  changeOrigin: true

I get absolutely zero response, except for a ECONNRESET after timeout. Any suggestions?

Heureka! I found the answer I was looking for! The offending party was (in my case) the express.urlencoded() middleware, which does some trickery that ultimately messes up the proxy. This can be resolved by applying the offending middleware after the proxy. Other middleware that might do this include cookie-parserand bodyParser (both of which are deprecated).

More on the issue here:

chimurai/http-proxy-middleware: The one-liner node.js http , Code Issues 99 Pull requests 10 Projects 0 Actions Security 0 Pulse. ⚡ The one-​liner node.js http-proxy middleware for connect, express and browser-sync #39 Api behind Basic authentication and NTLM authentication Opened by zychj1 #​97 [ Question ] How do you manipulate proxy response Opened by iroy2000  Zero response through http-proxy-middleware. 1. http-proxy-middleware not proxying to index page of other server? 0. Unable to proxy using http-proxy-middleware in

ViggoV You need to disable the SSL when the target is https.

Like as this:

app.use('/api', proxy({
  target: 'https://my.secret.endpoint',
  changeOrigin: true,
  secure: false

[ Question ] How do you manipulate proxy response · Issue #97 , GitHub is home to over 50 million developers working together to host and review express-http-proxy is inconvenient than http-proxy-middleware thus keep headersSent){ proxyRes.headers = {}; for(let x = 0; x < proxyRes. published 1.0.3 • 2 A piece of middleware for node-http-proxy that allows you to modify the remote service response with trumpet http proxy middleware for

Another solution for anyone coming here with the same issue but did not solve it.

In proxy configuration make sure you are matching any path with double ** not only *

const proxy = require("http-proxy-middleware");
module.exports = function(app) {
  app.use(proxy("/api/**", { //
    target: "http://localhost:5000",
    secure: false

For more check this reference

http-proxy-middleware: Docs, Tutorials, Metrics, http-proxy-middleware documentation, tutorials, code examples, API reference foo:// \_/ \ response delete proxyRes.headers['x-removed']; // remove header from response } changeOrigin: true/false, Default: false - changes the origin of the host header to the target URL. As the connection is made over HTTPS and the back-end server is only accepting HTTPS requests, I'm expecting, that this method is secure. But is it? Is there a possible attack vector? Is it possible that the implementation of the http-proxy-middleware leaks data through the HTTPS communication?

http-proxy-middleware, Description. The one-liner node.js proxy middleware for connect, express and browser-sync Publisher. avatar. monkpow. published 1.6.0 • 8 months ago. M Description. middleware for node-http-proxy to modify responses using streams  The one-liner node.js http-proxy middleware for connect, express and browser-sync. javascript proxy-middleware http-proxy proxy middleware nodejs browser-sync connect express websocket node polka. 14 contributors. TypeScript 99.9% JavaScript 0.1% chimurai Merge pull request #405 from chimurai/lintstaged. ci (pre-commit): lint-staged linting.

http-proxy-middleware, The one-liner node.js proxy middleware for connect, express and browser-sync. 0.19.0 • Public • Published 2 years ago. Readme · ExploreBETA · 4  So if 26 weeks out of the last 52 had non-zero commits and the rest had zero commits, the score would be 50%. Issues & PR Score: This score is calculated by counting number of weeks with non-zero issues or PR activity in the last 1 year period. So if 26 weeks out of the last 52 had non-zero issues or PR events and the rest had zero, the score

Deal with Cross-Origin Issues · GoodData.UI, This article explains how to deal with cross-origin issues (CORS). Specify Result Structure · Execute API Call · Execution Response and Execution Result const proxy = require('http-proxy-middleware'); module.exports = function (app) By default, you access the GoodData Portal via . The body parser was manipulating the request in transit which caused POST reqests with json to hang and never reach the server See this issue in http-proxy-middleware's github: chimurai/http-proxy-middleware#40

  • As you can see from my own answer I managed to fix it by other means. However it somehow works without secure: false, but it may be because both projects (api backend and express server) run within the same secure network(?). I'll definitely keep it in mind if I run into trouble when we take it into production. Thanks for the input in any case :)