-
Notifications
You must be signed in to change notification settings - Fork 10k
[STREAM] Add Media Transformations documentation for source origin controls #22228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dcpena
merged 2 commits into
cloudflare:production
from
bkrebsbach:tsmith_bkrebsbach/update-transformation-ao-docs
May 13, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| pcx_content_type: how-to | ||
| title: Define source origin | ||
| sidebar: | ||
| order: 4 | ||
| badge: | ||
| text: Beta | ||
| --- | ||
|
|
||
| When optimizing remote videos, you can specify which origins can be used as the source for transformed videos. By default, Cloudflare accepts only source videos from the zone where your transformations are served. | ||
|
|
||
| On this page, you will learn how to define and manage the origins for the source videos that you want to optimize. | ||
|
|
||
| :::note | ||
| The allowed origins setting applies to requests from Cloudflare Workers. | ||
|
|
||
| If you use a Worker to optimize remote videos via a `fetch()` subrequest, then this setting may conflict with existing logic that handles source videos. | ||
| ::: | ||
|
|
||
| ## Configure origins | ||
|
|
||
| To get started, you must have [transformations enabled on your zone](/stream/transform-videos/#getting-started). | ||
|
|
||
| In the Cloudflare dashboard, go to **Stream** > **Transformations** and select the zone where you want to serve transformations. | ||
|
|
||
| In **Sources**, you can configure the origins for transformations on your zone. | ||
|
|
||
|  | ||
|
|
||
| ## Allow source videos only from allowed origins | ||
|
|
||
| You can restrict source videos to **allowed origins**, which applies transformations only to source videos from a defined list. | ||
|
|
||
| By default, your accepted sources are set to **allowed origins**. Cloudflare will always allow source videos from the same zone where your transformations are served. | ||
|
|
||
| If you request a transformation with a source video from outside your **allowed origins**, then the video will be rejected. For example, if you serve transformations on your zone `a.com` and do not define any additional origins, then `a.com/video.mp4` can be used as a source video, but `b.com/video.mp4` will return an error. | ||
|
|
||
| To define a new origin: | ||
|
|
||
| 1. From **Sources**, select **Add origin**. | ||
| 2. Under **Domain**, specify the domain for the source video. Only valid web URLs will be accepted. | ||
|
|
||
|  | ||
|
|
||
| When you add a root domain, subdomains are not accepted. In other words, if you add `b.com`, then source videos from `media.b.com` will be rejected. | ||
|
|
||
| To support individual subdomains, define an additional origin such as `media.b.com`. If you add only `media.b.com` and not the root domain, then source videos from the root domain (`b.com`) and other subdomains (`cdn.b.com`) will be rejected. | ||
|
|
||
| To support all subdomains, use the `*` wildcard at the beginning of the root domain. For example, `*.b.com` will accept source videos from the root domain (like `b.com/video.mp4`) as well as from subdomains (like `media.b.com/video.mp4` or `cdn.b.com/video.mp4`). | ||
|
|
||
| 3. Optionally, you can specify the **Path** for the source video. If no path is specified, then source videos from all paths on this domain are accepted. | ||
|
|
||
| Cloudflare checks whether the defined path is at the beginning of the source path. If the defined path is not present at the beginning of the path, then the source video will be rejected. | ||
|
|
||
| For example, if you define an origin with domain `b.com` and path `/themes`, then `b.com/themes/video.mp4` will be accepted but `b.com/media/themes/video.mp4` will be rejected. | ||
|
|
||
| 4. Select **Add**. Your origin will now appear in your list of allowed origins. | ||
| 5. Select **Save**. These changes will take effect immediately. | ||
|
|
||
| When you configure **allowed origins**, only the initial URL of the source video is checked. Any redirects, including URLs that leave your zone, will be followed, and the resulting video will be transformed. | ||
|
|
||
| If you change your accepted sources to **any origin**, then your list of sources will be cleared and reset to default. | ||
|
|
||
| ## Allow source videos from any origin | ||
|
|
||
| When your accepted sources are set to **any origin**, any publicly available video can be used as the source video for transformations on this zone. | ||
|
|
||
| **Any origin** is less secure and may allow third parties to serve transformations on your zone. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.