CDN Integration
Integrate with CDN providers like CloudFront and Cloudflare for efficient asset delivery and cache management.
Basic CDN Integration
MoroJS provides built-in CDN integration middleware with support for CloudFront and Cloudflare.
CloudFront Integration
typescript
Cloudflare Integration
typescript
CDN Features
- • Support for CloudFront and Cloudflare
- • Automatic cache invalidation
- • Manual cache purging
- • Path prefix configuration
- • Asset URL generation
- • Cache management
Best Practices
Do
- • Use CDN for static assets
- • Purge cache on deployments
- • Use versioned filenames
- • Configure appropriate TTLs
- • Monitor CDN performance
- • Use path prefixes for organization
Don't
- • Cache dynamic content
- • Skip cache invalidation
- • Use CDN for sensitive data
- • Ignore CDN errors
- • Set very short TTLs
- • Purge entire cache unnecessarily