Skip to content
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

body is capped at 10MB with followRedirects=true #1412

Open
gigafied opened this issue Jan 17, 2020 · 3 comments
Open

body is capped at 10MB with followRedirects=true #1412

gigafied opened this issue Jan 17, 2020 · 3 comments

Comments

@gigafied
Copy link

follow-redirects defaults maxBodyLength to 10MB.

http-proxy does not expose a way to set any options for this module, what's worse is that the error is actually swallowed silently and the request aborted...

@ouadakarim
Copy link

ouadakarim commented Apr 27, 2020

Have the same issue. In the past (around v1.11) it worked fine, it seems the follow-redirects default settings have been changed. Would be useful if we could set the maxBodyLength in the proxy options. At the moment it's not really usable if you're redirecting requests with a body bigger than 10MB.

The error is catchable with the error handler:

proxy.on('error', (err) => console.log(err));

Below the stack trace:

Error: Request body larger than maxBodyLength limit
at RedirectableRequest.write (/var/project/node_modules/follow-redirects/index.js:82:24)
at IncomingMessage.ondata (_stream_readable.js:695:22)
at IncomingMessage.emit (events.js:310:20)
at addChunk (_stream_readable.js:286:12)
at readableAddChunk (_stream_readable.js:268:9)
at IncomingMessage.Readable.push (_stream_readable.js:209:10)
at HTTPParser.parserOnBody (_http_common.js:132:24)

@ouadakarim
Copy link

ouadakarim commented May 10, 2020

Created a PR for that #1441.

@blaizard
Copy link

Note, as a workaround, you can always set those values before calling http-proxy

import FollowRedirects from "follow-redirects";
FollowRedirects.maxRedirects = 10;
FollowRedirects.maxBodyLength = 1024 * 1024 * 1024 * 1024;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants