How-To: Handle larger body requests
Configure http requests that are bigger than 4 MB
Note
The existing flag/annotationdapr-http-max-request-size has been deprecated and updated to max-body-size.By default, Dapr has a limit for the request body size, set to 4MB. You can change this for both HTTP and gRPC requests by defining:
- The
dapr.io/max-body-sizeannotation, or - The
--max-body-sizeflag.
When running in self-hosted mode, use the --max-body-size flag to configure Dapr to use non-default request body size:
dapr run --max-body-size 16Mi node app.js
On Kubernetes, set the following annotations in your deployment YAML:
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
namespace: default
labels:
app: myapp
spec:
replicas: 1
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
annotations:
dapr.io/enabled: "true"
dapr.io/app-id: "myapp"
dapr.io/app-port: "8000"
dapr.io/max-body-size: "16Mi"
#...
This tells Dapr to set the maximum request body size to 16 MB for both HTTP and gRPC requests.
Related links
Dapr Kubernetes pod annotations spec