Low-Cost Image Hosting: Azure Blob Storage + Cloudflare (Custom Domain + SSL)



Last updated: November 6th, 2026

Updated November 2026: fixed the DNS examples (placeholder values were not displaying), added a quick answer, an FAQ for the most common validation and SSL errors, where Azure's own CDN options stand now, and when Cloudflare R2 is the better choice. Prices and dates are as of November 2026.

Quick Answer

  1. In Cloudflare DNS, add a proxied (orange cloud) CNAME: cdn → mystorageaccount.blob.core.windows.net.
  2. Add a DNS-only (grey cloud) CNAME: asverify.cdn → asverify.mystorageaccount.blob.core.windows.net.
  3. In Azure, add the custom domain to the storage account with Use indirect CNAME validation checked.
  4. In Cloudflare, set SSL/TLS to Full (strict).

Diagram: browser requests cdn.yourdomain.com over HTTPS, Cloudflare proxies and caches it, Azure Blob Storage is the origin; a separate DNS-only asverify CNAME is used for validation

Azure can't validate a domain whose CNAME is proxied (it sees Cloudflare's IPs, not its own host name), which is exactly what the asverify record solves.

Goal: serve images from cdn.yourdomain.com using Azure Blob Storage as the origin and Cloudflare for CDN caching and SSL. This is the setup cdn.ryanwilliams.io originally used. It's a simple, low-cost way to host images with global caching.

What you'll get

  • HTTPS at https://cdn.yourdomain.com/…
  • Cloudflare edge caching (fewer Azure egress charges over time)
  • End-to-end encryption with SSL/TLS: Full (strict) in Cloudflare

Prerequisites

  • An Azure Storage account (e.g., mystorageaccount.blob.core.windows.net)
  • Your domain on Cloudflare (e.g., yourdomain.com)
  • A subdomain for images (e.g., cdn.yourdomain.com)
  • A blob container that allows anonymous read access (or the $web container if you use Static Website)

Step 1: Cloudflare DNS, point your CDN subdomain to Azure

In Cloudflare → DNS, create a CNAME for your CDN subdomain and proxy it through Cloudflare:

Type:   CNAME
Name:   cdn
Target: mystorageaccount.blob.core.windows.net
Proxy:  Proxied (orange cloud)
TTL:    Auto

Requests to cdn.yourdomain.com now go through Cloudflare (caching + SSL) to your Azure Blob origin.

Step 2: Azure, add the custom domain with indirect CNAME validation

In the Azure Portal, open your Storage account and find Custom domain (under Networking in current portal layouts; older layouts show it under Settings or Blob service). Enter cdn.yourdomain.com and select Use indirect CNAME validation. Azure asks for an asverify record; add it in Cloudflare exactly as shown, and leave it unproxied:

Type:   CNAME
Name:   asverify.cdn
Target: asverify.mystorageaccount.blob.core.windows.net
Proxy:  DNS only (grey cloud)
TTL:    Auto
  • Click Save in Azure to complete validation.
  • Keep the main cdn record proxied and the asverify record DNS-only.

Step 3: Cloudflare, enable strict SSL

In Cloudflare → SSL/TLS, set Encryption mode to Full (strict).

Why? Azure's *.blob.core.windows.net endpoint presents a valid Microsoft certificate, so strict mode gives you proper end-to-end TLS between Cloudflare and Azure. Optionally, under Edge Certificates, enable Always Use HTTPS and HSTS.

Step 4: Upload and test

  • Upload an image to your container, e.g. images/logo.png.
  • Open https://cdn.yourdomain.com/images/logo.png.
  • The first load may be a cache MISS (see the cf-cache-status response header); reload to see a HIT.

Optional: set long cache headers on blobs

For static assets that never change at the same URL, set Cache-Control: public, max-age=31536000, immutable on the blobs. Cloudflare respects the origin's Cache-Control by default, which cuts origin requests and egress:

# Azure CLI: set Cache-Control on one blob
az storage blob update --account-name mystorageaccount --container-name images \
  --name logo.png --content-cache-control "public, max-age=31536000, immutable"

Troubleshooting

  • Custom domain won't validate in Azure: the asverify CNAME must be DNS only (grey cloud) and match Azure's value exactly. If you used direct validation, Azure needs the main record to be grey-cloud while validating; indirect validation avoids that.
  • 525/526 SSL errors: make sure the main cdn record is proxied, its target is your *.blob.core.windows.net endpoint, and the storage account has the custom domain registered. Cloudflare's strict mode accepts an origin certificate that matches the requested or target host name, and Azure presents its *.blob.core.windows.net certificate. If you still get a 526, check the certificate in the error details; setting the mode to Full (encrypted, but not validated) is a fallback, not a fix.
  • 403/404 errors: confirm the container allows anonymous read access and the blob path (including case) is correct.
  • Static website ($web) endpoint: if you serve from the z13.web.core.windows.net-style static website endpoint instead, point the CNAME at that host name, not at blob.core.windows.net.

Why this is cheap

  • Azure Blob Storage is inexpensive for storage and requests.
  • Cloudflare (Free plan) adds global caching and SSL at no extra cost.
  • You mainly pay Azure egress on cache misses; hits are served from Cloudflare's edge.

Azure's Own Options: Front Door and Azure CDN

Azure Blob Storage custom domains are still HTTP only on their own (Microsoft Learn), so HTTPS needs something in front. Microsoft now points people to Azure Front Door. As of November 2026, Azure CDN from Edgio has already shut down (January 2025), and Azure CDN Standard from Microsoft (classic) no longer accepts new profiles and retires on September 30, 2027 (Front Door and CDN comparison). Front Door is a solid choice if you want to stay inside Azure, but it has a monthly base fee; Cloudflare's free plan is why I used it here.

Cloudflare Blob Storage: When R2 Is Simpler

If you searched for "Cloudflare blob storage", Cloudflare also has its own object storage, R2. If your files don't need to live in Azure, R2 removes a moving part: no asverify record, no origin egress bill, and the custom domain is a button in the R2 dashboard. Pricing as of November 2026 (R2 pricing):

Azure Blob + CloudflareCloudflare R2
StorageAzure's per-GB rate for your tier and region$0.015 per GB-month (Standard); first 10 GB free
EgressAzure bandwidth charges on cache missesFree
RequestsAzure per-operation rates1M writes and 10M reads per month free, then $4.50 / $0.36 per million
Custom domain + SSLTwo CNAMEs + Full (strict), as aboveConnect a domain in the bucket settings (the zone must be in the same Cloudflare account)
Best whenYour app already writes to Azure StorageYou are starting fresh or moving files anyway

Use a custom domain rather than the bucket's r2.dev URL in production: Cloudflare rate-limits r2.dev and says it is for development only (R2 public buckets). R2 speaks the S3 API, so most S3 tools and SDKs work with it.

TL;DR: exact settings

# Cloudflare DNS
CNAME  cdn           -> mystorageaccount.blob.core.windows.net            (Proxied)
CNAME  asverify.cdn  -> asverify.mystorageaccount.blob.core.windows.net   (DNS only)

# Azure > Storage account > Networking > Custom domain
Domain name: cdn.yourdomain.com   [x] Use indirect CNAME validation   -> Save

# Cloudflare > SSL/TLS
Encryption mode: Full (strict)

Frequently Asked Questions

Can I use Cloudflare in front of Azure Blob Storage?

Yes. Proxy a CNAME to the blob endpoint through Cloudflare, register the custom domain on the storage account with indirect (asverify) validation, and use Full (strict) SSL.

Why does Azure custom domain validation fail with the Cloudflare proxy on?

With the orange cloud on, DNS lookups return Cloudflare's IP addresses instead of a CNAME to Azure, so Azure can't see that you own the domain. Validate with the DNS-only asverify record instead.

Does Azure Blob Storage support HTTPS on a custom domain by itself?

Not directly: Blob Storage custom domains only support HTTP on their own. For HTTPS you need a CDN or proxy in front, such as Cloudflare or Azure Front Door.

Does Cloudflare have blob storage?

Yes, Cloudflare R2 is S3-compatible object storage with no egress fees and a free tier of 10 GB. You can also keep files in Azure Blob Storage and use Cloudflare only as the CDN and SSL layer, which is what this guide does.

Do I need a custom SSL certificate for a CDN subdomain on Cloudflare?

No. Cloudflare's free Universal SSL certificate covers first-level subdomains such as cdn.yourdomain.com. You only need an advanced or custom certificate for deeper names like img.cdn.yourdomain.com.

That's it. You've got a fast, low-cost image CDN on your own domain using Azure Blob Storage and Cloudflare.


Comments

No Comments

CAPTCHA

Tagged: Azure


Join my email list!



ryan
About Me

With over 15 years in tech, I've excelled as a senior software engineer, specializing in ASP.NET, C#, SQL, Azure, and front-end technologies. I've led diverse projects across various sectors, from startups to global corporations, particularly during my decade in the San Francisco Bay Area.


Sign Up Hostinger Email