-   Notifications  
You must be signed in to change notification settings  - Fork 873
 
Description
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
- Create script 
testUpload.sh(or usescripts/testUpload.shin supplied repo) 
ENDPOINT=$1 FILE=large.file RATELIMIT=10M echo "Testing upload to $ENDPOINT" if ! [ -f "$FILE" ]; then echo "Generating test file..." dd if=/dev/zero of=$FILE bs=1048576 count=2048 fi echo "Testing upload at $RATELIMIT" curl -X POST $ENDPOINT -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@${FILE}" --limit-rate $RATELIMIT --progress-bar --verbose -o ${RATELIMIT}.out- Run script as 
testUpload.sh URL - Wait for it
 
After 60 seconds I recieve
... * Recv failure: Connection reset by peer * stopped the pause stream! * Closing connection 0 Simiar behavior is seen in browser.The request gets net::ERR_CONNECTION_RESET with error message TypeError: Failed to fetch in Chrome and TypeError: 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 as
const { createProxyMiddleware } = require("http-proxy-middleware"); const TIMEOUT = 30*60*1000; module.exports = (app) => { app.use( "/api", createProxyMiddleware({ target: "http://127.0.0.1:5000", changeOrigin: true, pathRewrite: { "^/api": "", }, proxyTimeout: TIMEOUT, timeout: TIMEOUT, onError: (err, req, res) => console.log(err) }) ); };client 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.