Quick Answer
CDN (Content Delivery Network) accelerates global content delivery by serving static assets from servers near users. The problem: D2C in New York, customer in Tokyo = 6,700 miles = 200ms+ latency = sluggish site = customer leaves. The solution: CDN puts static assets (images, JS, CSS) on servers in 200+ cities. Tokyo customer downloads from 5 miles away, not 6,700 miles = 20ms latency = instant feel. Odoo integration: (1) Built-in support: No custom code needed. (2) Configuration: Website → Settings → SEO & Performance → Enable CDN → CDN Base URL (https://cdn.yourbrand.com) → CDN Filters (^/web/static/, ^/web/image). (3) How it works: Odoo rewrites HTML from yoursite.com/web/image/123 to cdn.yoursite.com/web/image/123, browser requests from CDN, CDN caches and serves. Two approaches: (1) Subdomain CDN (AWS CloudFront, KeyCDN): Create distribution, set origin to Odoo URL, configure CNAME. (2) Cloudflare (recommended): Full site proxy, point DNS to Cloudflare, set SSL to Full, zero Odoo config, DDoS protection + WAF free. Common issues: CORS errors (fix: add Access-Control-Allow-Origin header in Nginx), stale content (Odoo uses hash in URLs, manual purge if needed), mixed content (always use HTTPS for CDN). Impact: Without CDN = ignore 50% of global market. With CDN = instant feel worldwide.
The Global Latency Problem
Your D2C brand is based in New York. A customer in Tokyo visits your site.
Without CDN:
- ✗ HTML, CSS, JavaScript, and Images travel 6,700 miles through undersea cables
- ✗ Latency: 200ms+
- ✗ Site feels sluggish
- ✗ Customer leaves
The CDN Solution
With CDN:
- ✓ Static assets on servers in Tokyo, London, Sydney, and 200+ other cities
- ✓ Tokyo customer downloads from 5 miles away, not 6,700 miles
- ✓ Latency: 20ms
- ✓ Site feels instant
We've implemented 150+ Odoo systems. For local B2B businesses, a CDN is optional. For D2C brands selling globally, it is mandatory. Without it, you are ignoring 50% of your potential market.
How Odoo CDN Integration Works
Odoo has built-in support for CDNs. You don't need custom code. You just need configuration.
The Logic
1. Normal: Odoo serves image from https://yoursite.com/web/image/123
2. With CDN: Odoo rewrites HTML to https://cdn.yoursite.com/web/image/123
3. Browser: Requests image from CDN
4. CDN Hit: Serves instantly if cached
5. CDN Miss: Fetches from Odoo once, caches, serves
Step 1: Configure CDN Provider
You cannot just invent a URL. You need a provider (CloudFront, KeyCDN, etc.).
Setup (Generic)
1. Create Distribution: Create a "Pull Zone" or "Distribution"
2. Origin Server: Set to your Odoo URL (e.g., https://www.yourbrand.com)
3. CNAME: Create subdomain cdn.yourbrand.com → point to provider URL (e.g., d1234.cloudfront.net)
4. Cache Headers: Respect Cache-Control headers from Odoo, or force TTL of 7+ days for static assets
Step 2: Configure Odoo
1. Log in as Administrator
2. Go to Website → Configuration → Settings
3. Scroll to SEO & Performance section
4. Enable Content Delivery Network (CDN)
5. CDN Base URL: Enter CNAME (e.g., https://cdn.yourbrand.com)
CDN Filters
This tells Odoo which file types to rewrite.
^/[^/]+/static/, ^/web/(css|js)/, ^/web/image, ^/web/content
Meaning: "Rewrite all static module files, all compiled CSS/JS, and all database images/attachments."
Save. That's it. Odoo will now start rewriting URLs on your frontend.
The Cloudflare Approach (Recommended)
Cloudflare is different. It acts as a reverse proxy for your entire domain, not just a cdn.subdomain.
Why It's Better for Odoo
Zero Config: No Odoo settings change needed. Just point DNS to Cloudflare
Security: DDoS protection + WAF (Web Application Firewall) free
HTML Caching: With Page Rules, cache HTML pages (homepage) → TTFB almost zero
Configuration for Odoo
DNS: Point NS records to Cloudflare
SSL: Set SSL/TLS to "Full (Strict)" → Cloudflare talks to Nginx using HTTPS
Caching Rules
Page Rule: /web/static/* → Cache Level: Cache Everything
Page Rule: /web/image/* → Cache Level: Cache Everything
Warning: Do NOT cache /shop/cart or /web/login pages, or users will see each other's carts! Cloudflare respects Odoo's session cookies by default, but be careful with "Cache Everything" rules.
Common Pitfalls & Fixes
1. CORS Errors (Fonts/Icons)
Problem: You load CSS from cdn.yoursite.com. The CSS tries to load a font file. Browser blocks it because cdn.yoursite.com is different from www.yoursite.com.
Fix: Configure Nginx on your Odoo server to send Access-Control-Allow-Origin header.
# In your Nginx config
location / {
# ...
add_header Access-Control-Allow-Origin "*";
}
2. Stale Content
Problem: You update a product image, but the CDN keeps showing the old one.
Fix:
Odoo's Native Mechanism: Odoo appends unique hash to filenames (e.g., logo.png?v=123). When you update the file, hash changes, forcing CDN to re-fetch
Manual Purge: If using Cloudflare, click "Purge Cache" for hardcoded static files
3. Mixed Content
Problem: If your CDN URL is http:// but your site is https://, browser will block the assets.
Fix: Always use HTTPS for your CDN Base URL.
Action Items: Setup CDN
Check Latency
❏ Use GTmetrix or Pingdom. Test from location far from server (e.g., Australia)
❏ Look at "Waterfall." Are images taking 500ms+ to connect?
Setup
❏ Choose strategy: Subdomain CDN (AWS CloudFront/KeyCDN) OR Full Proxy (Cloudflare)
❏ If Cloudflare: Change DNS, set SSL to Full
❏ If CloudFront: Create distribution, configure Odoo Website Settings
Verify
❏ Inspect website source. Do image URLs start with CDN domain?
❏ Check Console for CORS errors (red text about fonts)
Frequently Asked Questions
Does Odoo have built-in CDN support?
Yes, Odoo has native CDN integration. No custom code required. Configuration: Website → Configuration → Settings → SEO & Performance → Enable CDN → CDN Base URL (https://cdn.yourbrand.com) → CDN Filters (regex patterns for static files, images, CSS/JS). How it works: Odoo automatically rewrites URLs in generated HTML from yoursite.com/web/image/123 to cdn.yoursite.com/web/image/123. Browser requests from CDN, CDN caches and serves. CDN Filters default: ^/[^/]+/static/, ^/web/(css|js)/, ^/web/image, ^/web/content = rewrite all static module files, compiled CSS/JS, database images/attachments. No code changes needed—just configuration.
Should I use Cloudflare or AWS CloudFront for Odoo?
Cloudflare is recommended for most Odoo deployments. Cloudflare advantages: (1) Full site reverse proxy—no Odoo config changes needed, just point DNS. (2) Free DDoS protection + WAF (Web Application Firewall). (3) Can cache HTML pages with Page Rules (homepage, product pages) for near-zero TTFB. (4) Automatic HTTPS, respects session cookies. CloudFront advantages: (1) Better for AWS-hosted Odoo (same region = lower egress costs). (2) More granular cache control. (3) Better for enterprise with complex compliance. Setup difference: Cloudflare = change DNS, set SSL mode. CloudFront = create distribution, configure Odoo CDN settings. Cost: Cloudflare free tier sufficient for most D2C. CloudFront pay-per-use.
How do I fix CORS errors with CDN fonts and icons?
CORS errors occur when CSS from cdn.yoursite.com tries to load fonts/icons and browser blocks cross-origin request. Fix: Add Access-Control-Allow-Origin header in Nginx on your Odoo server. Configuration: In Nginx config, add to location / block: add_header Access-Control-Allow-Origin "*"; (or specific domain for tighter security). Why: This tells browser it's safe to load fonts/icons from CDN domain even though they're hosted on origin server. Alternative: Host fonts directly on CDN (upload to CDN provider), but Nginx header is simpler. Verification: Check browser Console (F12) for red CORS errors. After fix, errors should disappear and fonts should load correctly.
Why does my CDN still show old images after I update them?
Stale content occurs when CDN cache isn't invalidated after updates. Odoo's automatic solution: Odoo appends unique hash to filenames (e.g., logo.png?v=1234567). When you update file via Odoo UI (product image, attachment), hash changes automatically, forcing CDN to fetch new version (cache bust). Manual solution: For hardcoded static files in custom modules, manually purge CDN cache. Cloudflare: Dashboard → Caching → Purge Cache. CloudFront: Create invalidation for specific paths. Prevention: Always update images through Odoo UI, not by overwriting files on server. Cache TTL: Set CDN cache to 7+ days for static assets—Odoo's hash system ensures updates propagate despite long cache.
Free Global Performance Audit
Is your site slow for international customers? We'll test your site speed from 5 different continents, analyze your CDN configuration (or lack thereof), fix Nginx CORS headers preventing font loading, and optimize your Cloudflare Page Rules for Odoo. Don't let distance kill your conversion rate.
