Skip to content

A public image returns 403 only with an external referrer

Compare image requests with absent, same-site, and external referrers, identify the hotlink rule, and verify a narrow fix for intended public image use.

By Crawlito · 5 min read

In short

  • Hotlink rules can treat the same image differently depending on the request's Referer header.
  • Cloudflare's documented built-in behavior distinguishes an empty referrer from an external one.
  • Test the intended display context and preserve unrelated protections when changing image rules.
On this page

If an image works on your website but returns 403 when displayed from another site, compare requests with different Referer headers and inspect the rule that rejects them. Hotlink protection can deliberately permit one context and deny another. Decide which public uses are intended, adjust the responsible rule narrowly, and retest the original display path.

Do not assume every image 403 is a crawler block. An expired URL, authorization requirement, bot rule, or missing object can produce a similar symptom. The response and security evidence should identify the actual cause.

Start with the exact image address

Find the URL used by the failing page or preview, including its hostname, path, and any public parameters. A social image can live on a different service from the article itself.

Open the image directly and inspect its status, content type, and body. Confirm that it is the intended image rather than an HTML error page with an image-like filename.

Then reproduce the original context: the page, preview, or integration where the image fails. Record whether the browser or service sends a referrer and what the asset host returns.

The link-preview guide helps trace the relationship between the page's metadata and the actual advertised image.

Keep signed or private image URLs out of shared diagnostic notes. For public-content testing, use an asset intended to be accessible without account credentials.

A direct visit is a useful control, but it does not reproduce every embedded request. That difference is the reason to inspect the request context.

Compare three controlled request shapes

For an image you own or are authorized to test, make small diagnostic requests that vary only the referrer:

bash
curl -sS -D no-referrer.txt -o no-referrer.bin \
  'https://images.example.com/public/guide.jpg'
curl -sS -e 'https://www.example.com/blog/guide' \
  -D own-referrer.txt -o own-referrer.bin \
  'https://images.example.com/public/guide.jpg'
curl -sS -e 'https://external.example/preview' \
  -D external-referrer.txt -o external-referrer.bin \
  'https://images.example.com/public/guide.jpg'

Compare the status and body for each request. Keep cookies, authorization, and other inputs consistent.

These are controlled reproductions from your machine. They do not authenticate a real crawler or prove what another service sends.

A difference linked to the referrer is a lead, not final proof of the rule owner. Correlate the requests with the asset service's logs or security events.

If all three fail identically, investigate the common delivery problem before changing hotlink settings.

Cloudflare's Hotlink Protection documentation describes its built-in rule as rejecting a nonempty referrer that does not include the website's domain. It distinguishes that from a blank referrer.

That detail matters: do not claim that Cloudflare's built-in feature necessarily blocks every request without a referrer. A custom Worker, server rule, or another provider can implement a different policy.

The same documentation describes effects on external image display and the supported file extensions. Check the current product behavior before assuming a rule covers every image format.

Inspect the configuration actually attached to the asset hostname. The page hostname's settings may be irrelevant to a separately managed image domain.

The image CDN discovery guide explains why the asset delivery path deserves its own review.

If the provider's documented behavior does not match your observations, look for additional rules rather than forcing the evidence into the first explanation.

Identify the legitimate sharing requirement

Decide which uses the public image should support. A product photo used in search or a social preview may need a different sharing policy from a private customer upload.

Write down the intended contexts before changing the rule. This avoids replacing an access problem with an unreviewed broad allowance.

Do not treat the Referer header as proof of identity. Clients can omit or change it, and its presence alone does not establish that a request belongs to a trusted crawler.

For actual bot verification, use the crawler verification guide and the operator's documented methods where available.

Keep private media behind appropriate authorization. A referrer-based hotlink rule is not a substitute for controlling access to confidential files.

For a public marketing-image folder, a narrow exception may be a suitable design. For other assets, the correct decision may be to preserve the restriction and use a different approved image in the external context.

Apply the smallest supported rule change

Change the component that produced the denial: the CDN setting, configuration rule, Worker, web-server directive, or storage layer.

Use the provider's supported mechanism to scope the change to the relevant public assets or intended context. Cloudflare documents selective configuration approaches; verify the current options for your account and delivery setup.

Do not disable unrelated bot, rate-limit, or application security rules while correcting an image-sharing policy.

If the asset is intentionally private, repair the application flow rather than publishing it openly. The diagnosis should preserve the distinction established in the previous step.

Keep the prior rule and the reason for the change in the release record. This helps the next operator understand why one folder differs from the rest of the media service.

After deployment, inspect whether an old denial remains cached. Follow the delivery platform's recovery process only after confirming the responsible rule and origin response are correct.

Verify the original context and useful controls

Repeat the three controlled requests, then test the actual preview or embedding path that originally failed. The external service's result is the practical acceptance test.

Confirm the image dimensions, format, and content. A 200 response containing a placeholder is not the intended repair.

Test a second asset under the same rule to check its scope. If the change was meant for one public folder, verify a representative asset outside that folder retains its intended behavior.

Keep a blank-referrer request in the test set when it is relevant to the provider's documented policy. It prevents a broad “external requests work” statement from hiding a different outcome for omitted referrers.

Do not declare success solely because a cache-busting URL works. Recheck the normal image address advertised by the page.

For a social preview, allow for the service's own refresh behavior and use its supported inspection or refresh process where available.

Report the image failure separately from page access

An article may be accessible while its preview image is denied. Report those as distinct findings so a successful page check does not conceal the image problem.

Describe the request context, matched rule, scoped change, and verified result. Avoid saying “all AI bots were blocked” when only a referrer-dependent image request was tested.

If historical logs support a broader scope, state the affected host and period. Do not infer lost visits or conversions from the presence of a rule alone.

For future releases, include the public preview image in checks whenever metadata or media hosting changes. A new storage domain can introduce different sharing behavior without changing the article text.

Keep the image URL stable where appropriate and ensure the page continues advertising the verified asset. Fixing an unused file does not repair the reader's actual preview.

Frequently asked questions

No. Behavior depends on the implementation. Cloudflare's documented built-in feature distinguishes blank referrers from nonempty external ones.

Can a copied user-agent string prove a crawler is allowed?

No. It is a test input, not identity verification. Use real request evidence and the operator's documented verification methods.

Should every image be exempt from protection?

No. Choose the intended public uses and scope the change accordingly. Private media needs its own authorization design.

After verifying the image path, run its public landing page through the free Crawlito check to inspect the page's access and metadata together.

Filed under CDN and bot protection. Topics: images, cloudflare, troubleshooting