Skip to content

Limit formdata file size #300

Closed Answered by kartikk221
SupertigerDev asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, there are multiple ways to approach this:

  • Specify a global max_body_length when creating the HyperExpress.Server instance to restrict global Request body size.
  • Specify a route-specific max_body_length when creating the route with options to restrict that specific route's body size.
  • Specify a custom limit within the BusboyConfig.limits options when calling Request.multipart(config) to specify a custom limiter within the multipart parser itself.

Overall, I would recommend handling this at the Server/Route level since then HyperExpress will gracefully flush any incoming additional data and handle closing of the request for you for oversized requests.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@SupertigerDev
Comment options

@SupertigerDev
Comment options

@SupertigerDev
Comment options

Answer selected by kartikk221
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants