I am seeing a 60 seconds timeout when using chimurai/http-proxy-middleware
in Create-React-App
and I cannot understand where it is coming from.
I am running an API on port 5000 and configured setupProxy.js
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)
})
);
};
I generate a file using
dd if=/dev/zero of=large.file bs=1048576 count=2048
and then using curl
ENDPOINT="http://localhost:3000/api/v1/storage"
RATELIMIT=10M
curl -X POST $ENDPOINT -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@big.file" -w "@curl-format.txt" --limit-rate $RATELIMIT --verbose
cURL yields
* Recv failure: Connection reset by peer
* stopped the pause stream!
* Closing connection 0
Same behavior is seen in browser (Chrome and Firefox).
In node v12.18.3 this was no problem, but it seems to be prevalent in v13.x and v14.x.