A high-performance Cloudflare Workers implementation of the TompHTTP Bare Server Protocol v3. This edge server provides global, low-latency proxy capabilities with automatic scaling.
- TompHTTP Bare Protocol v3 - Full protocol compliance
- Global Edge Network - Deploy to 300+ Cloudflare locations
- WebSocket Support - Full bidirectional WebSocket proxying
- Automatic Scaling - No server management required
- Header Stripping - Removes X-Frame-Options, CSP, and other security headers
- CORS Support - Full cross-origin request handling
- Error Handling - Comprehensive error responses with tracking IDs
- Node.js 18 or later
- Cloudflare account
cd openbare/edge
npm installnpm run login
# or
npx wrangler loginThis will open your browser to authenticate with Cloudflare.
npm run devThis starts a local development server at http://localhost:8787
npm run deployYour worker will be available at https://openbare-edge.<your-subdomain>.workers.dev
Edit wrangler.toml to configure:
[vars]
BARE_VERSION = "3"
MAX_PAYLOAD_SIZE = "104857600" # 100MB-
Add your domain to Cloudflare
- Go to Cloudflare Dashboard
- Add your domain and update nameservers
-
Configure routes in wrangler.toml
routes = [ { pattern = "bare.yourdomain.com/*", zone_name = "yourdomain.com" } ]
-
Deploy with custom domain
npm run deploy:production
GET /
GET /health
Response:
{
"status": "ok",
"service": "openbare-edge",
"version": "3",
"edge_location": "SJC",
"cf_ray": "abc123-SJC",
"country": "US",
"timestamp": "2024-01-15T10:30:00.000Z"
}GET /bare/
Response:
{
"versions": ["v1", "v2", "v3"],
"language": "Cloudflare Workers",
"project": {
"name": "openbare-edge",
"version": "1.0.0"
}
}[ANY METHOD] /bare/v3/
Headers:
x-bare-url: https://example.com/path
x-bare-headers: {"User-Agent": "Mozilla/5.0..."}
Response includes:
x-bare-status: 200
x-bare-status-text: OK
x-bare-headers: {"content-type": "text/html", ...}
| Header | Required | Description |
|---|---|---|
x-bare-url |
Yes | Target URL to fetch |
x-bare-headers |
No | JSON object of headers to send |
x-bare-forward-headers |
No | Headers to forward from original request |
x-bare-pass-headers |
No | Response headers to pass through |
x-bare-protocol |
No* | Protocol (http:/https:) |
x-bare-host |
No* | Target host |
x-bare-port |
No* | Target port |
x-bare-path |
No* | Target path |
*Alternative to x-bare-url
| Header | Description |
|---|---|
x-bare-status |
HTTP status code from target |
x-bare-status-text |
HTTP status text from target |
x-bare-headers |
JSON object of response headers |
WebSocket connections are supported through the same endpoint:
const ws = new WebSocket('wss://your-worker.workers.dev/bare/v3/');
// Include bare headers in the connectionnpm run deploy:stagingDeploys to openbare-edge-staging.*.workers.dev
npm run deploy:productionDeploys to your configured production routes
npm run tail- Workers Analytics
- View requests, errors, and performance metrics
"Error: No account ID found"
npx wrangler whoami
# Make sure you're logged in
npx wrangler login"Error: Workers Site not found"
# Update wrangler
npm update wranglerWebSocket connections failing
- Ensure target supports WebSockets
- Check for firewall/proxy issues
- Verify the target URL is correct
Run with verbose logging:
WRANGLER_LOG=debug npm run dev- This server strips security headers to allow embedding
- Intended for development and specific use cases
- Consider rate limiting for production use
- Monitor for abuse through Cloudflare dashboard
Cloudflare Workers have the following limits:
| Limit | Free | Paid |
|---|---|---|
| Requests/day | 100,000 | Unlimited |
| CPU time | 10ms | 50ms (30s for Unbound) |
| Memory | 128MB | 128MB |
| Subrequest | 50 | 1000 |
MIT License - See LICENSE for details.
- OpenBare Server - Node.js bare server
- OpenBare Client - JavaScript client library
- TompHTTP Bare Server Spec