I was using R2, the S3 compatible bucket by Cloudflare that advertises zero-egress fees.
A natural use case is to allow third parties to upload content into your bucket for you to manage, index and
order. Providing a suitable controlled interface for such is always a bit of a challenge.
Cloudflare provides an excellent way to run serverless functions called Workers. Standalone they are impressive
since they are running as V8 isolates, many in a single process, similar to how Chromium tabs work.
Tangent
In Chromium
each process can have multiple V8 isolates running at the same time, however for security considerations is
locked to documents from a single site.
Ok, not entirely true, but it's a good way to get the point across. Mobile devices that are a bit more resource
constrained are somewhat isolated, with several heuristics used, such as sites that are most likely to have
user-specific information.
So, I just said that they are grouped as same-sites. That's because origins are a bit different. Origin is defined to include scheme, hostname and port, while site only means scheme and eTLD+1.
What are eTLDs? They are subdomains that associated with the TLD that act as if they effectively a TLD by itself. One example of an eTLD is co.uk, where co is a subdomain for the .uk TLD. In fact, .uk wasn't allowed to be registered directly until 2014, no wonder co.uk is so popular.
So, why not use same-origin isolation instead? Apparently a Web API called document.domain allows you to effectively modify the origin at runtime, with the side-effect of making it an unreliable metric to cluster tabs. Why is it there? By allowing a few subdomains to say they are part of the same superdomain, they can easily communicate by relaxing the same-origin policy. Of course, there are weird holes with this approach, so Chromium is trying to get rid of it.
Webkit just follows a simple one process per tab model instead of dealing with these wacky definitions, where two webpages are never
consolidated into the same rendering process, even
under high memory pressure and even if they share an eTLD+1 in
their URLs. Instead, Webkit spawns a new rendering process for each
tab until the system runs out of memory.
Why do they do this? To place the burden of preventing timing attacks on the OS.
Cloudflare loves to advertise to use Workers for everything, so they suggest just route all requests to a Worker
and let it firewall access to your bucket.
However, Workers suffer with the problem of a max request body size of a few hundred MB, so it wasn't the right fit. I was looking for
allowing to upload larger sized content, a few GB.