Public delivery & presigned URLs
Comwit supports two browser-safe paths. Public assets use a stable
*.comwit.link base URL. Private or user-specific transfers use a short-lived
presigned URL issued by the platform API. Neither path exposes a Comwit token to
the browser.
Public objects
Section titled “Public objects”Enable public delivery during create or afterward:
comwit storage public enable \ --project <project-id> \ --storage <storage-id>Poll comwit storage get until public_access=enabled,
public_domain_status=active, and public_tls_status=active. Only then is
public_base_url returned.
Build an object URL from the base and the exact key:
const imageURL = `${process.env.COMWIT_STORAGE_PUBLIC_BASE_URL}/products/desk.png`;Public requests travel directly through Cloudflare Cache to R2; they do not
consume Storage Gateway or runtime bandwidth. If you use next/image, add the
returned Storage hostname to images.remotePatterns.
Disabling public access removes direct delivery but does not delete objects.
Presigned browser upload
Section titled “Presigned browser upload”Your authenticated application server requests one URL from the platform API:
curl -X POST \ -H "Authorization: Bearer $COMWIT_TOKEN" \ -H "Content-Type: application/json" \ https://api.cloud.comwit.io/v1/projects/<project-id>/storages/<storage-id>/presigned-urls \ -d '{ "operation": "put_object", "key": "uploads/avatar.png", "content_type": "image/png", "expires_in_seconds": 900 }'The response contains url, method, required headers, and expires_at.
Return only those values to the authorized browser, then use them exactly:
await fetch(url, { method, headers, body: file,});Supported operations are get_object, head_object, put_object, and
delete_object. GET/HEAD require storage:read; PUT/DELETE require
storage:write. Expiration is bounded to 60–3600 seconds.
The managed policy accepts any application origin because Comwit apps may use generated or custom domains. That does not make private objects public: R2 still requires the short-lived URL signed for the exact object operation.
Exact request and response schemas are in the Scalar API reference.