Is it OK to serve images from Workers and KV?

I was reading the terms of service and found this:

Use of the Service for serving video (unless purchased separately as a Paid Service) or a disproportionate percentage of pictures, audio files, or other non-HTML content, is prohibited.

Does this apply to Workers and KV too or only the CDN?

I’m asking since we’re paying per request and stored data on Workers and KV while the CDN is actually free.

Edit:

The Workers terms of service don’t mention anything about KV.

2 Likes

Exactly, you are paying per request plus storage, so it is acceptable. It is different than Cloudflare as proxy.

And what about the Cache API? Does this fall in the CDN terms of service?

That TOS provison applies to all content going through their network, not just things in the cache or using the cache API.

If you’re going to be serving a large volume of images that aren’t a central part of your website’s service, chances are it’s against the ToS. For example, a lot of image boards use Cloudflare and do just fine, sometimes even on the free plan pushing terabytes of data a month since image boards are almost exclusively accessed via the board’s domain itself, rarely having images “hotlinked” to them (sometimes it’s even forbidden by the image board operators since it does still hit their own wallet at some point).

I also know many people that have a CF account with one zone that is only set up to serve images, but because they’re for personal use, and they only push 50gb/month if that, they barely put any strain on the network and existing doesn’t cost cloudflare almost anything. But a lot of people do get shut down once they start doing terabytes a month and are only putting their image subdomain on CF.

All in all, this section of the ToS is there to try to prevent solo customers from abusing the service and becoming big loss-leaders - costing CF hundreds or thousands of dollars a month in bandwidth isn’t going to go well, especially if you’re doing it just for images or binary files.

Now, as for KV, I think it would be different since you’re paying both per-request and per-GB, but I would clarify this with support:

If you have questions about if your specific use case is allowed, you may contact support https://support.cloudflare.com/hc/en-us/requests/new. If you have an autoresponder bot reply to you, reply back. Make sure your message is clear about you asking if your use case is acceptable and include information such as your core premise and how these images will be accessed.

4 Likes

Thanks @Judge for the great info.

Like you said, it would be best to contact support and clarify with them.

So I contacted support but the person that answered didn’t really have a clue what I was asking and referred to the general TOS clause I mentioned in my first post.

I then asked on Twitter to someone from the Workers team and they confirmed it’s totally fine to do this.

I also chatted with someone using Workers to serve millions of images and again he said no problem.

It would be great if Cloudflare updated their TOS for workers and KV and also informed their support people!

1 Like

I’m actually building a service right now, that downloads images and send to an API end-point. I expect millions of images to be downloaded monthly this way. Since I’m not publicly serving anything or “abusing” the service this way, it is actually serving a purpose, so I expect it to be fine. And should the consumption be larger than CF want to handle for Worker cost, then I don’t mind paying extra.

1 Like

It’s really weird.

I got another email from support and they insisted that my use case was not ok:

We have helped bring it to check internally and Workers is still bound by the same Terms.

Generally speaking, “File lockers are not permitted”, and at the same time, the use to store resource would also put in risk in violation against Terms 2.8 as we have already mentioned in earlier response, and we will suggest against it to avoid being route off of Cloudflare.

Which not only contradicts what other people have been saying to me, but also contradicts this official blog post promoting the use of Workers to serve files from B2.

3 Likes

@harris maybe we can get some clarity into the issue?

Hi @pier, @thomas4,

If the question is whether Workers KV can be used to host pictures for a blog website, such use is fine, assuming that the website is not serving a disproportionate percentage of pictures, audio files, or other non-HTML content.

I’m sorry for, and share, the confusion. The question has sparked much internal discussion on how to clarify section 2.8 with regards to Workers and Workers KV.

Harris

4 Likes

Thanks @harris for the answer.

I’m actually working on a blogging platform which of course would serve HTML and non HTML content from many blogs using Workers.

I was considering storing those images in KV before realizing I could actually use Blackblaze or Digital Ocean (with the Bandwidth Alliance).

Is this a reasonable use case?

After all I’d be paying Cloudflare per request anyway regardless of wether I’m doing 1M or 100M requests per month.

Edit:

Also, in your blog post about B2 + Workers you are actually promoting video which is super heavy compared to images.

So, using worker to send pictures to an API is not fine?

Update: I’ve been committed to workers for more than a year and I’m about to give up entirely because of all of the road-blocks that appear and keep being introduced. Screw requests being cheaper if you’re going to block my service entirely due to bandwidth consumption - on Amazon Lambdas, we can at least pay for bandwidth.

6 Likes

@pier The blogging platform use case is entirely reasonable. We don’t expect any issues there.

@thomas4 I’ll follow-up privately to get both get more information on your use case and to get you more clarity on our terms as they apply to you.

4 Likes

Fantastic!

Thanks for your answer @aly .

Does section 2.8 also imply that API endpoints will be a problem? We have everything behind CF, and REST APIs are a big component (still not scary big volume yet though) of what we do. The APIs are security protected and include encrypted components. The html public part of the website is tiny use.

Not adverse to paying more (currently PRO) as we grow, but dont want to suddenly get a nasty ‘this is against TOS’ - esp as we invest more energy into load balancing and other tech.

2 Likes

@aly @harris @signalnerve @cscharff
This is extremely disappointing, No where it is mentioned that Cloudflare workers with KV are subjected to non HTML ToS violation bans. Even in the limits section of workers docs. https://developers.cloudflare.com/workers/about/limits/

The entire point of having workers is serverless and there is no way to turn off proxy by design. As this is 2020, the quality of images will only go up along with size, images and other media would always have disproportionate bandwidth by default. With the advent of new technologies the number of filetypes are dynamically increasing, that’s not necessarily under Cloudflare’s ToS.

The variables are already in place where maximum KV value is 10mb where storage and number of allowed KV requests are capped with overage charges. So it should be an easy calculation of bandwidth buffer that worker site can use and the more bandwidth the worker site uses, the more cost that’s going to incur. Developers shouldn’t have to worry about violating ToS and getting the site banned essentially destroying companies and clients especially when redeveloping worker sites to traditional deployment involves months of redevelopment of process. The answers here specified that “blogs are fine” doesn’t inspire confidence. Everyone wants their website to grow exponentially, it’s a troubling thought that website popularity means cloudflare ban for violating ToS. Why place more restrictions, ban clauses with Workers especially when it’s a paid service.

It’s not like someone would build an imgur.com clone with hotlinking for just $5. Let’s take an imaginary twitter clone with various filetypes deployed with cloudflare workers that’s rising in popularity. Below is cost analysis of extreme usage scenario for that worker site.

Cloudflare Workers with KV monthly cost: $5

KV Storage: 101 GB -> 1 GB included + 100*0.5 = $50

HTML/JS KV Reads: 20 million requests -> 10 million requests included + 10*0.5 = $5

Non-HTML media KV reads: 10 million * average of 5 MB requests -> 10*0.5 = $5 (50 TB bandwidth)

KV Writes: 6 million requests = 1 million included + 5*5 = $25

KV Deletes: 2 million kv requests = 1 million included + 1*5 = $5

Total: $95 per month

Comparing this to commercial CDN only service like BunnyCDN volume pricing: $250 per month for above bandwidth and requests/storage are included.

Obviously Cloudflare is significantly cheaper than commercial CDN, however it’s not a real world scenario where worker sites would overwhelm cloudflare servers because of non HTML content without incurring some kind of cost. Please either reduce free requests, or increase cost of requests, but do not implement ToS violation bans especially when variables like, number of requests, KV maximum filesize are well known.

6 Likes

Would be nice to see a response to this post. Securing developer buy-in seems contingent on not googling people. If you’re going to build a pay-per-use platform, you can’t be wishy washy about what constraints exist. Leaving things tenuous is going to cause predictable problems.

2 Likes

[archived]

5 Likes

[archived]

5 Likes

@pier @thomas4 @harris @aly @cscharff

We want to clarify that using Workers KV to host images as part of a blogging platform is an acceptable use case. We are actively working on changing the language in Section 2.8 of the Terms of Service to reflect that, and those changes will be coming soon.

11 Likes