Custom Preview Proxy
Daytona allows you to deploy your own custom preview proxy to handle preview URLs for sandboxes. This gives you complete control over the preview experience, including custom domains, authentication, error handling, and styling.
What you can do with a custom preview proxy:
- Custom Domain: Host your proxy under your own domain (e.g.,
preview.yourcompany.com
) - User Authentication: Implement custom authentication logic for private previews
- Smart Sandbox Management: Automatically start stopped sandboxes before forwarding users
- Custom Error Pages: Style error pages to match your brand
- Preview Warning Control: Disable Daytona’s preview warning
- CORS Management: Override Daytona’s default CORS settings
How It Works
When a user visits a preview URL, your custom proxy receives the request and can:
- Authenticate the user using custom logic
- Check sandbox status and start it if needed
- Forward the request to the actual sandbox
- Handle responses with custom styling and error pages
- Send custom headers to control Daytona’s behavior
Daytona Headers
Your proxy can send special headers to control Daytona’s behavior:
Disable Preview Warning
To disable Daytona’s preview warning page, send:
X-Daytona-Skip-Preview-Warning: true
Disable CORS
To override Daytona’s default CORS settings, send:
X-Daytona-Disable-CORS: true
Authentication
For private preview links, users should send:
X-Daytona-Preview-Token: {sandboxToken}
The sandboxToken
can be fetched through the Daytona SDK or API.
Examples
You can find examples of custom preview proxies on our Github: