Restrict video streaming by domain

Hi guys, I would like to know if it is possible to restrict access to a video that is on my CDN on B2 using Cloudflare.

I tried to do this through the firewall, I can block it, but it also cannot play.

If anyone knows if this is possible to be done on the free cloudflare level I would be very grateful.

Can you talk a bit more about who you are trying to ‘allow’ and who you would like to ‘block’?

Firewall Rules is very flexible and you can achieve this in a number of ways including using other features such as Cloudflare for Teams or Workers. It really depends on what specifically you’re trying to do - most of it will be achievable on any plan level.

Hi Simon,

I have a website where I offer video content to subscribers, I currently use the vimeo solution.

Yesterday I spent a few hours working on a player so when my vimeo quota fills up I have an alternative to keep uploading videos.

However in the player I’m using I can’t limit access to the video file only within my domain.

What I mean is that if you look for the file in the html code and put it in your browser, it will play.

With vimeo I have a configuration that doesn’t allow this, the streaming happens only inside my domain.

I know this is kind of weak security, but it’s better than nothing.

Do you have any idea how I can do this?

If you have control of the video URL - e.g. you can serve the video from a subdomain that is powered via Cloudflare, you can protect it. You could use something like token authentication to protect the URLs:

Outside of this, if you wanted to use Stream (Cloudflare’s native product for video delivery), you can also do this more simply as a first-class feature of the product:

https://developers.cloudflare.com/stream/viewing-videos/securing-your-stream

Simon, my content is on blackbaze and I’m already passing my bucket through cloudflare.

In this case which solution would be best for me?
Can I use this feature on the free level?

The idea of using a token seems bad to me because if he plays the video again after watching it he’ll have to reload the page.

In this case Workers could work better, allowing it to reproduce as many times as it wants within the domain, do you believe this is possible?

@artedogesto the guides cover how to set a longer expiry for each token. Any of these approaches should work.

Simon could you explain to me more about how this would work?
For example, if a user opens the html code and copies the url link in the valid period of the token and pastes it into his browser, will he have access to the file?

My conclusion was that this is not possible to be solved in CloudFlare’s free plan using the Firewall.

To use the solution via firewall you need Business or Enterprise.

I’m going to create a new thread to talk about this using Worker.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.