Hotlink Protection, HTTP Referer Checks, and Partner Exceptions
How edge hotlink protection uses HTTP referers on images, when to enable it, and how to exempt partners, folders, and SaaS hostnames.
This page summarises Cloudflare documentation on Hotlink Protection, part of Scrape Shield. Hotlink Protection stops other websites from pulling your image bandwidth by embedding assets hosted on your zone unless the request’s HTTP referer matches your site—or you deliberately allow exceptions.
Hotlink Protection: what it blocks and why
Section titled “Hotlink Protection: what it blocks and why”Hotlink Protection exists to stop third-party pages from hotlinking—embedding or linking to your hosted images so visitors load bytes from your origin.
Hotlink Protection prevents your images from being used by other sites, which can reduce the bandwidth consumed by your origin server.
— Cloudflare, Hotlink Protection
The same goal appears in Configuration Rules settings and Defend content with Scrape Shield. In analytics, blocked hotlinks may appear as threat type Blocked hotlink:
Hotlink Protection ensures that other sites cannot use your bandwidth by building pages that link to images hosted on your origin server. This feature can be turned on and off by Cloudflare’s customers.
— Cloudflare, Threat types
For media-heavy sites, Hotlink Protection is one layer alongside signed URLs and Access; see Secure your content.
HTTP referer checks: how Hotlink Protection decides allow or deny
Section titled “HTTP referer checks: how Hotlink Protection decides allow or deny”Hotlink Protection runs at the edge when Cloudflare receives a request for a protected image type. It is not a full anti-piracy stack for all media, but a referer-based gate on matching file extensions.
When Cloudflare receives an image request for your site, we check to ensure the request did not originate from visitors on another site. Visitors to your domain will still be able to view images.
Technically, this means that Hotlink Protection denies access to requests when the HTTP referer does not include your website domain name (and is not blank).
— Cloudflare, Hotlink Protection
Supported image file extensions for Hotlink Protection
Section titled “Supported image file extensions for Hotlink Protection”Only requests whose paths end in certain extensions are subject to the check:
The supported file extensions are gif, ico, jpg, jpeg, and png.
— Cloudflare, Hotlink Protection
Other asset types (for example many video URLs) are outside this feature’s extension list; broader media protection is described separately in Secure your content.
Hotlink Protection vs crawlers and social image previews
Section titled “Hotlink Protection vs crawlers and social image previews”Crawlers can still fetch resources; display on third-party surfaces is what changes.
Hotlink protection has no impact on crawling, but it will prevent the images from being displayed on sites such as Google images, Pinterest, and Facebook.
— Cloudflare, Hotlink Protection
Plan exceptions (for example the hotlink-ok path or selective configuration rules) if you want logos or marketing images visible when embedded elsewhere.
Enable Hotlink Protection: zone toggle, API, and Configuration Rules
Section titled “Enable Hotlink Protection: zone toggle, API, and Configuration Rules”You can turn protection on for the whole zone or tune it per hostname or path with Configuration Rules.
Turn on Hotlink Protection in the dashboard
Section titled “Turn on Hotlink Protection in the dashboard”- In the Cloudflare dashboard, open Security → Settings (optionally filter by Client-side abuse).
- Set Hotlink Protection to On.
Cloudflare documents the same flow under Hotlink Protection.
Enable Hotlink Protection with the API
Section titled “Enable Hotlink Protection with the API”Send a PATCH with hotlink_protection in the URI path and value set to "on", as described on Hotlink Protection.
For Configuration Rules, the boolean property is hotlink_protection inside action_parameters:
"action_parameters": { "hotlink_protection": false}See Configuration Rules settings for API field names and examples.
Hotlink Protection on specific hostnames instead of the whole zone
Section titled “Hotlink Protection on specific hostnames instead of the whole zone”To use this feature on specific hostnames - instead of across your entire zone - use a configuration rule.
— Cloudflare, Hotlink Protection
Use a configuration rule when only some hostnames or paths should enforce referer checks, or when you need to disable Hotlink Protection for a subtree (for example an image folder) while leaving the zone toggle on—see Configuration rules on the same page.
Partner referers and SaaS custom hostnames
Section titled “Partner referers and SaaS custom hostnames”Default Hotlink Protection allows referers that include your zone domain. Partner sites and SaaS customer hostnames often fail that test.
Exempt partners from Hotlink Protection with custom rules or Configuration Rules
Section titled “Exempt partners from Hotlink Protection with custom rules or Configuration Rules”When enabled, Cloudflare Hotlink Protection blocks all HTTP referrers that are not part of your domain or zone. That presents a problem if you allow partners to use inline links to your assets.
— Cloudflare, Exempt partners from Hotlink Protection
Two patterns:
| Approach | Hotlink Protection toggle | Behaviour |
|---|---|---|
Custom rule on http.referer |
Turn off so partner referers are not blocked by the global feature | Block requests whose referer is not from partner domains |
| Configuration rule | Keep on | Exclude partner referers from Hotlink Protection for matching requests |
For custom rules, Cloudflare’s example blocks when the referer is not a partner:
When incoming requests match:
not (http.referer contains "example.com" or http.referer eq "www.example.net" or http.referer eq "www.cloudflare.com")Then take action: Block
— Cloudflare, Exempt partners from Hotlink Protection
For Configuration Rules:
Alternatively, you can create a configuration rule to exclude HTTP referrals from partner sites from Hotlink Protection. In this case, you would keep the Hotlink Protection feature enabled.
— Cloudflare, Exempt partners from Hotlink Protection
Cloudflare for SaaS: customer custom hostnames as referers
Section titled “Cloudflare for SaaS: customer custom hostnames as referers”If you are a SaaS provider using Cloudflare for SaaS, note that, by default, Hotlink Protection will only allow requests with your zone as referer. To avoid blocking requests from your customers (custom hostnames), consider using Configuration Rules or custom rules.
— Cloudflare, Hotlink Protection
Allow hotlinking for specific images: hotlink-ok paths and RSS
Section titled “Allow hotlinking for specific images: hotlink-ok paths and RSS”You may want certain files embeddable—by search image surfaces, feeds, or affiliates.
You may want certain images to be hotlinked to, whether by external websites (like Google) or certain situations like when using an RSS feed.
— Cloudflare, Hotlink Protection
Place assets under a hotlink-ok directory
Section titled “Place assets under a hotlink-ok directory”You can allow certain images to be hotlinked by placing them in a directory named hotlink-ok. The hotlink-ok directory can be placed anywhere on your website.
To allow another website to use logo.png from example.com, put logo.png in a new folder called hotlink-ok.
— Cloudflare, Hotlink Protection
Examples of URLs that skip the hotlink check:
http://example.com/hotlink-ok/pic.jpghttp://example.com/images/hotlink-ok/pic.jpghttp://example.com/hotlink-ok/images/pic.jpghttp://example.com/images/main-site/hotlink-ok/pic.jpg
(from Hotlink Protection)
Disable Hotlink Protection selectively with Configuration Rules
Section titled “Disable Hotlink Protection selectively with Configuration Rules”To disable Hotlink Protection selectively, create a configuration rule covering the path of an image folder.
— Cloudflare, Hotlink Protection
Pair path-based rules with the hotlink_protection parameter in Configuration Rules settings when you need folder-level control without renaming directories.
Logs and analytics: confirm a block was Hotlink Protection
Section titled “Logs and analytics: confirm a block was Hotlink Protection”When a request is denied, edge pathing metadata can show a hotlink ban:
| EdgePathingStatus | Description | EdgePathingOp | EdgePathingSrc |
|---|---|---|---|
| empty | Blocked request. | ban | hot |
— Cloudflare, Pathing status (row Hot Linking)
Use this alongside Blocked hotlink in Threat types when correlating user reports of broken images on partner sites.
Common mistakes when images break after enabling protection
Section titled “Common mistakes when images break after enabling protection”- Leaving zone-wide Hotlink Protection on while partners or SaaS customers embed images with referers that do not include your zone—fix with Exempt partners from Hotlink Protection or SaaS guidance on Hotlink Protection.
- Expecting hotlink blocking on non-listed extensions—only
gif,ico,jpg,jpeg, andpngare covered per Hotlink Protection. - Blaming Hotlink Protection for every missing image—Troubleshoot missing images also lists cache purge, pausing Cloudflare, and disabling Rocket Loader before chasing referer rules.
How to check this on your site
Section titled “How to check this on your site”- Enable or disable Hotlink Protection under Security → Settings as in Hotlink Protection, then load a
jpg/pngURL from your own site (should work) and the same URL inside a simple HTML page on another host with a non-matchingReferer(should fail when protection is on). - For partner or SaaS layouts, verify referers with the expressions from Exempt partners from Hotlink Protection and confirm customer hostnames match Hotlink Protection SaaS notes.
- After changes, check zone analytics for Blocked hotlink in Threat types and, if you ship logs,
EdgePathingSrchotin Pathing status. - If images still fail, follow Troubleshoot missing images to rule out cache and Rocket Loader before adjusting Scrape Shield.
- You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.