Upload Limits
Upload limits allow you to control and restrict file uploads in your application. This feature helps prevent abuse and ensures efficient resource usage.
Configuration Structure
upload_limit:
- name: "test"
rule: http.request.uri.path contains "/upload" and (http.request.headers[*].content-type eq "image/png" or http.request.headers[*].content-type eq "application/pdf")
size: 100 # in megabytes
enabled: true
This rule match only when the path contains /upload
and the content-type is either image/png
or application/pdf
Configuration Options
Name
- Type: String
- Required: Yes
- Description: Unique identifier for the upload limit rule
- Example:
name: "test"
Rule
- Type: String
- Required: Yes
- Description: Wirefilter expression to match requests
- Example:
rule: (http.request.uri.path contains "/testupload")
Size
- Type: Integer
- Required: Yes
- Description: Maximum file size in megabytes
- Example:
size: 100
Enabled
- Type: Boolean
- Default:
true
- Description: Whether the rule is active
- Example:
enabled: true
Best Practices
- Set appropriate size limits based on your application's needs
- Use specific path matching in rules
- Consider implementing different limits for different types of uploads
- Monitor upload patterns to adjust limits as needed
Example Configurations
Basic Upload Limit
upload_limit:
- name: "document-uploads"
rule: (http.request.uri.path contains "/documents")
size: 10
enabled: true
Multiple Upload Limits
upload_limit:
- name: "image-uploads"
rule: (http.request.uri.path contains "/images")
size: 5
enabled: true
- name: "video-uploads"
rule: (http.request.uri.path contains "/videos")
size: 100
enabled: true
Common Use Cases
- Document Uploads: Limit document uploads to 10MB
- Image Uploads: Restrict image uploads to 5MB
- Video Uploads: Allow larger video uploads up to 100MB
- User Profile Pictures: Small size limits for profile pictures