How-To: Handle large http body requests

Configure http requests that are bigger than 4 MB

By default Dapr has a limit for the request body size which is set to 4 MB, however you can change this by defining dapr.io/http-max-request-size annotation or --dapr-http-max-request-size flag.

When running in self hosted mode, use the --dapr-http-max-request-size flag to configure Dapr to use non-default request body size:

  1. dapr run --dapr-http-max-request-size 16 node app.js

This tells Dapr to set maximum request body size to 16 MB.

在Kubernetes中,需要在deployment YAML文件中设置以下注解:

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: myapp
  5. namespace: default
  6. labels:
  7. app: myapp
  8. spec:
  9. replicas: 1
  10. selector:
  11. matchLabels:
  12. app: myapp
  13. template:
  14. metadata:
  15. labels:
  16. app: myapp
  17. annotations:
  18. dapr.io/enabled: "true"
  19. dapr.io/app-id: "myapp"
  20. dapr.io/app-port: "8000"
  21. dapr.io/http-max-request-size: "16"
  22. ...

相关链接