HttpServer resource creates an HTTP API endpoint for your Ditto database, allowing any HTTP client (including web browsers) to query and manipulate data using standard REST methods. This enables integration with systems that cannot use the Ditto SDK directly.
Basic Configuration
Required Fields
Optional HTTP Server Fields
Request Timeout
Health Check Endpoint
API Documentation
TLS Configuration
Configure HTTPS on the HTTP server:Throttling Configuration
Rate limit requests to prevent DoS attacks:Throttling Strategy Configuration
Each strategy in thestrategies array has the following fields:
Strategy Types:
ip_address: Throttle based on client IP address. All requests from the same IP share the same rate limit. Useful for protecting against IP-based DoS attacksapi_key: Throttle based on API key credential provided in the request. Throttling happens BEFORE authentication completes, preventing brute force attacks on specific API keys. Each API key has its own rate limitroute: Throttle based on the request endpoint. All clients share the same rate limit per endpoint. Useful for protecting expensive operations
When multiple strategies are configured, a request must pass ALL rate limit checks. For example, with both IP and API key strategies, the IP address AND the API key must both be under their respective limits.
Listen Address Configuration
Thelisten_addr field specifies where the HTTP server listens for connections:
- IPv4 localhost:
"127.0.0.1:PORT"or"localhost:PORT" - IPv6 localhost:
"[::1]:PORT"or"[::]:PORT"
HTTP API Configuration
Thehttp_api field controls which endpoints are enabled:
Simple Configuration
Enable or disable all endpoints:Fine-Grained Configuration
Control individual endpoints and their limits:- Boolean:
execute: true(uses server defaults) - Object:
execute: {enabled: true, max_body_size_mb: 50}(custom limits)
Endpoint Request Limits Object
When using object form for an endpoint:API Endpoints
All endpoints are served directly from the listen address (no base path prefix).Execute Endpoint
Path:POST /execute
Execute DQL queries against the database.
Request body:
- Timeout header: Specify custom timeout for the request
- Success (200): Query results in JSON format
- Error (4xx/5xx): Error details with appropriate HTTP status code
Health Check Endpoint
Path:GET /health
Simple health check that returns HTTP 200 if the server is running.
Presence Endpoint
Path:GET /presence
Get information about connected peers and their presence status.
Logs Endpoint
Path:GET /logs
Retrieve logs from the Edge Server and Ditto SDK.
Attachments Endpoints
Upload: Upload new attachments to the database Download: Retrieve attachments from the databaseComplete Examples
Basic HTTP Server
http://127.0.0.1:8080/execute
HTTP Server with TLS
https://localhost:3000/execute
Health Check Only Server
Minimal configuration for monitoring:http://127.0.0.1:9090/health
Advanced Configuration with Fine-Grained Control
Using the HTTP API
Query Execution Example
Health Check Example
Security Considerations
While Ditto Edge Server is in private preview, no deployments should be considered secure. Use is for development purposes only.Important Notes
- Single Database: Edge Server supports one database per instance
- Port Conflicts: Ensure the HTTP server port doesnโt conflict with other services
- Restart Required: Changes to HTTP server configuration require Edge Server restart
- IPv6 Support: Use bracketed notation for IPv6 addresses (e.g.,
"[::1]:8080") - TLS Required: The
tls_configfield is required - usedev_modefor HTTP or provide certificate/key for HTTPS