Hotlink Protection

Last updated Aug 3, 2026 Hotlink Protection prevents your images from being used by other sites, which can reduce the bandwidth consumed by your origin server ↗︎.

The supported file extensions are gif, ico, jpg, jpeg, and png.

Background

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 download and 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).

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.

To enable Hotlink Protection in the dashboard:

  1. In the Cloudflare dashboard, go to the Security Settings page. Go to Settings ↗
  2. (Optional) Filter by Client-side abuse.
  3. For Hotlink Protection, switch the toggle to On.

To enable Hotlink Protection with the API, send a PATCH request with hotlink_protection as the setting name in the URI path, and the value parameter set to "on".

Note

To use this feature on specific hostnames - instead of across your entire zone - use a configuration rule.

SaaS providers using Cloudflare

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.


Allow hotlinking to specific images

You may want certain images to be hotlinked to, whether by external websites (like Google) or certain situations like when using an RSS feed.

Configuration rules

To disable Hotlink Protection selectively, create a configuration rule covering the path of an image folder.

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.

Some examples of URLs that will not be checked for hotlinking:

  • http://example.com/hotlink-ok/pic.jpg
  • http://example.com/images/hotlink-ok/pic.jpg
  • http://example.com/hotlink-ok/images/pic.jpg
  • http://example.com/images/main-site/hotlink-ok/pic.jpg

Was this helpful?

YesNo

On this page

Hotlink Protection - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/waf/tools/scrape-shield/hotlink-protection/#page","headline":"Hotlink Protection","description":"Prevent other sites from linking to your hosted images.","url":"https://developers.cloudflare.com/waf/tools/scrape-shield/hotlink-protection/","inLanguage":"en","image":"https://developers.cloudflare.com/waf/tools/scrape-shield/hotlink-protection/og.png?v=fe5b4185285f3a63","dateModified":"2026-08-03","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Set the Security Level threshold for challenging suspicious visitors. title: Security Level image: https://developers.cloudflare.com/waf/tools/security-level/og.png?v=cb57e42a09c54404


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/waf/llms.txt
Use this file to discover all available pages before exploring further.