Replies: 1 comment
-
Any updates? Is there way to compress next api? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
As it is, API routes seem to ignore
content-encoding
entirely. If you specifycontent-encoding: gzip
andcontent-type: application/json
, the router will call thebodyParser
middleware, which will attempt to deserialize JSON and fail because the body is a gzipped stream.Non-Goals
No response
Background
We build apps that handle webhooks, which sometimes means hundreds of kilobytes of JSON data posted to an endpoint thousands of times per second. It would be nice to compress the data in-flight and save 80–90% of the bandwidth.
Proposal
It would be nice to be able to add compressed payload support to API routes as easily as it's enabled for output.
I guess a workaround would be to disable the
bodyParser
middleware, and to write a custom replacement and wrap all API routes with it?Beta Was this translation helpful? Give feedback.
All reactions