chimurai / http-proxy-middleware

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

Proxy Middleware is trying to Retry the server call after its timed out #803

Closed nanepallysaikumar closed 2 years ago

nanepallysaikumar commented 2 years ago

Checks

Describe the bug (be clear and concise)

1.We are using the http proxy middleware for proxying the back end request. 2.Back end is spring boot application. 3.Front End is React JS. 4.We are using htttp proxy middleware using express JS

Problem Statement: When making an API call, after certain time out, GUI is making another trigger to the back end. Although there is no retry mechanism configured.

Step-by-step reproduction instructions

1. Make API call from UI
2. Once request is timed out, another back end call is triggered from the express JS middleware - which is not acceptable as this kind of feature is not configured in the code.

Expected behavior (be clear and concise)

No retry should happen even after the request is timed out.

How is http-proxy-middleware used in your project?

npm ls http-proxy-middleware

What http-proxy-middleware configuration are you using?

import * as express from 'express';
import { createProxyMiddleware, Filter, Options, RequestHandler } from 'http-proxy-middleware';

const app = express();
const proxy = require("http-proxy-middleware")

app.use(
  '/api',
  createProxyMiddleware({
    target: 'http://www.example.org/api',
    changeOrigin: true,
  })
);

app.listen(3000);

What OS/version and node/version are you seeing the problem?

Linux with nodejs

Additional context (optional)

No response

nanepallysaikumar commented 2 years ago

@chimurai - can u please help?

chimurai commented 2 years ago

Don't remember having a retry mechanism...

Think it might be your frontend doing the retry?

Can you provide a minimal reproduction?

chimurai commented 2 years ago

Feel free to reopen issue when minimal reproduction can be provided

mathobbs commented 1 year ago

I experienced similar where for a web api handler that always takes three minutes to complete the proxy would always initiate a second unexpected call at the 2 minute mark. Setting both proxyTimeout and timeout to a high value stopped this from happening for me.

To repro I created a new aspnetcore project with a controller containing a thread.sleep(3 minutes) and proxied to it to repro.