Skip to main content
The 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:
Using tls_config: dev_mode will keep network traffic as HTTP, making it vulnerable to man-in-the-middle attacks. Always use TLS in production by providing certificate and key.

Throttling Configuration

Rate limit requests to prevent DoS attacks:

Throttling Strategy Configuration

Each strategy in the strategies 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 attacks
  • api_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 limit
  • route: 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

The listen_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"
Common examples:

HTTP API Configuration

The http_api field controls which endpoints are enabled:

Simple Configuration

Enable or disable all endpoints:

Fine-Grained Configuration

Control individual endpoints and their limits:
Each endpoint can be configured as:
  • 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:
Optional headers:
  • Timeout header: Specify custom timeout for the request
Response:
  • 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 database

Complete Examples

Basic HTTP Server

Access the API at: http://127.0.0.1:8080/execute

HTTP Server with TLS

Access the API at: https://localhost:3000/execute

Health Check Only Server

Minimal configuration for monitoring:
Access health check at: 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_config field is required - use dev_mode for HTTP or provide certificate/key for HTTPS