English | 简体中文
Cloudflare Worker WebDAV shim for CC-switch cloud sync. It is built as a companion for the open-source CC-switch tool, exposing the small WebDAV subset CC-switch needs and storing files in a private Cloudflare R2 bucket.
This is intentionally small. It is not a complete WebDAV server, and it does not try to cover general file management. The goal is to give CC-switch a stable sync endpoint backed by your own R2 storage.
Use this project if you want to:
- Store CC-switch cloud sync data in your own R2 bucket.
- Deploy a small Worker with no database and no always-on server.
- Protect the sync endpoint with Basic Auth.
- Support only the WebDAV methods CC-switch needs.
This project is not meant to be:
- A general-purpose WebDAV file server.
- A multi-user storage system.
- A replacement for full file management tools.
- A complete WebDAV compatibility layer for arbitrary clients.
OPTIONSfor capability checksPROPFINDfor connection checks and path existenceMKCOLas a directory-compatible no-opPUTto upload objects into R2GETto download objects from R2, including range responsesHEADfor object metadata and ETag checks
It is not a full WebDAV server. It is intentionally scoped to CC-switch sync files.
The following are intentionally not implemented:
DELETEMOVE/COPYLOCK/UNLOCK- Directory listing
- Multi-user permissions
- Quotas, sharing, versioning, or audit logs
- Compatibility guarantees for every WebDAV client
- Create an R2 bucket, for example
cc-switch-sync. - Update
wrangler.tomlif your bucket name is different. - Install dependencies:
pnpm install- Configure Worker values for Basic Auth:
pnpm wrangler secret put DAV_LOGIN
pnpm wrangler secret put DAV_CODEThese two secrets are the Basic Auth credentials checked by the Worker:
DAV_LOGINcorresponds to the WebDAV account field in CC-switch.DAV_CODEcorresponds to the WebDAV password/code field in CC-switch.
For deployed usage, configure both values. If both are missing, the Worker treats Basic Auth as disabled.
- Deploy:
pnpm deployYour WebDAV endpoint uses the deployed Worker domain and the configured DAV_PREFIX.
Create a local .dev.vars file with your own values:
DAV_LOGIN=<your-login>
DAV_CODE=<your-code>
Then run:
pnpm devRun type checks:
pnpm typecheckUse the deployed Worker URL as the WebDAV server URL:
WebDAV Server URL: https://<your-worker-domain>/dav/
WebDAV Account: <same value as DAV_LOGIN>
WebDAV Password: <same value as DAV_CODE>
Remote Directory: cc-switch-sync
The resulting R2 object keys will look like:
cc-switch-sync/current/db.sql
cc-switch-sync/current/skills.zip
cc-switch-sync/current/manifest.json
| Name | Type | Default | Description |
|---|---|---|---|
CC_SWITCH_BUCKET |
R2 binding | Required | R2 bucket used to store sync objects. |
DAV_LOGIN |
Worker value | Empty | Basic Auth account name. Auth is disabled only when both DAV values are empty. |
DAV_CODE |
Worker value | Empty | Basic Auth shared code. |
WEBDAV_REALM |
Worker var | CC Switch R2 WebDAV |
Basic Auth realm shown by clients. |
DAV_PREFIX |
Worker var | /dav |
URL path prefix used as the WebDAV root. |
- Always configure
DAV_LOGINandDAV_CODEbefore deploying a public Worker. - Do not commit local deployment config.
- Keep the R2 bucket private and access it through the Worker.
- This project does not provide audit logging, rate limiting, tenant isolation, or abuse controls.
- Use HTTPS Worker URLs only.
Not recommended. It implements only the methods CC-switch needs for cloud sync.
R2 is object storage, not a traditional filesystem. The Worker treats directory creation as a compatibility response so WebDAV clients can continue their sync flow.
The root path and WebDAV root return a small status page so you can confirm the Worker is running and identify the endpoint.
The repository is intended to be open source, but the package is not configured for npm publishing. Keeping private: true prevents accidental publication.

