-
Notifications
You must be signed in to change notification settings - Fork 858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy timeouts after 60 seconds #458
Comments
Even we are also facing the same issue, but request is getting timed out for 30 seconds only. |
@johanbook Did u find any solution to fix this? |
@nanepallysaikumar I downgraded my node version to 12.10 which fixed it |
@johanbook But isn't the issue due to the http proxy middleware?. ´´´ const proxyData = proxy(options); const app = express(); // establish http server connection |
@nanepallysaikumar my guess is that it was a breaking change between node 12 and 13 that broke http-proxy-middleware. Well, you are using it in your express server and the error might arise from server-side. However, if you already are using node 10 to run your express application it might be something else. Maybe try upgrading node to 12 and see if there is any difference |
I seem to have a similar problem using node 14.0.20. Did anyone discover anything except downgrading to 12? |
Found this line in my code base :D
Removing/Moving that middleware fixed my issue. Hopefully, this PR solves problems like this in the future |
This might be due to nodejs/node#35661, as pointed out in https://stackoverflow.com/questions/62911472/60-second-timeout-in-http-proxy-middleware/65106664#65106664 |
After upgrading my Node version this is no longer a issue |
Thank you so much @Mousaka . This solved my issue! What a headache. |
@Mousaka Thanks for your advice! i think this is due to the body(payload) parsing. and when i moved middleware before the |
I found this GitHub issue after all my POST requests to the proxied URL were timing out with errors from the upstream host. The timeout could be 30, 60 or 120 seconds depending on the host server technology and configuration. I assumed it was my http-proxy-middleware config, but it's actually because of a proxy middleware before mine that I can't control (in this case, a Google Cloud Function). To fix, I followed #492. Simply: const { createProxyMiddleware, fixRequestBody } = require('http-proxy-middleware');
const proxy = createProxyMiddleware({
//...usual config here
onProxyReq: fixRequestBody,
});
// or
const proxy2 = createProxyMiddleware({
//...usual config here
onProxyReq: (proxyReq, req) => {
// do what you want first, then
fixRequestBody(proxyReq, req);
},
}); |
Is this a bug report?
POST requests with form data seems to be timedout at 60 seconds. Happens in node version 13.x and 14.x but not 12.x. This might be a bug in
node-http-proxy
.Steps to reproduce
testUpload.sh
(or usescripts/testUpload.sh
in supplied repo)testUpload.sh URL
After 60 seconds I recieve
Simiar behavior is seen in browser.The request gets
net::ERR_CONNECTION_RESET
with error messageTypeError: Failed to fetch
in Chrome andTypeError: NetworkError when attempting to fetch resource.
in Firefox.Expected behavior
Request goes on until finished.
Actual behavior
Request vanishes. Our server got yielded
client disconnected
. Client never receives a response.Setup
Frontend is created with
Create-React-App
with a separate API on port 5000.setupProxy.js
is configured asclient info
The app is run inside Docker container based on
node:14.5.0-alpine
. Same error is encountered when run an Ubuntu system. This is the case for node versions 13.x and 14.x but not 12.x.target server info
A Python FastAPI server that allows file uploads on endpoint
POST /v1/storage
.Reproducible Demo
Here is a minimum working example of the front end1l; https://github.com/johanbook/http-proxy-middleware-upload-bug. Bash script included.
The text was updated successfully, but these errors were encountered: