Is it possible to ensure the maximum load size in Plack :: Middleware without reading the entire request body?

I just converted the PageKit application (mod_perl) to Plack . This means that I now need some way to provide the POST_MAX / MAX_BODY that Apache2 :: Reques t previously handled. The easiest way to do this is probably to just put nginx in front of the application, but the application is already behind HAProxy , and I don’t see how to do it with HAProxy.

So my question is: how can I achieve the maximum body size in Plack :: Middleware without first reading the entire request text ?

In particular, I am interested in downloading files. Checking the size with Plack :: Request :: Upload is too late , because at that moment the whole body would be read. The application will be deployed through Starman , so psgix.streaming should be true .

+8
perl plack psgi
source share
1 answer

I received a response from Tatsuhiko Miyagawa via Twitter . He says: "If you deploy with Starman too late even with middleware because buffering is enabled, I would do it with nginx."

This answers my specific question as I am dealing with the deployment of Starman.

He also noted that β€œ rejecting a large load before reading it can cause problems in the backend ”

+3
source share

All Articles