IPFS and CDN: Bridging Decentralized and Traditional Content Delivery

· James Thornton · 10 min read

The InterPlanetary File System (IPFS) and traditional CDNs solve the same fundamental problem—getting content from where it is stored to where it is needed—through radically different architectural philosophies. CDNs use centrally managed edge servers with location-based addressing (URLs). IPFS uses a decentralized peer-to-peer network with content-based addressing (cryptographic hashes). Each approach has strengths the other lacks: CDNs deliver predictable, low-latency performance at scale but depend on centralized infrastructure. IPFS provides content integrity verification and censorship resistance but suffers from inconsistent discovery latency and peer bandwidth.

The practical convergence of these systems is already underway. Major CDN providers operate IPFS gateways at their edge nodes, pinning services store content on CDN infrastructure, and hybrid architectures use IPFS for content verification while relying on CDN caching for delivery performance. This article examines how these integrations work, the technical challenges of bridging content-addressed and location-addressed systems, and the use cases where hybrid IPFS-CDN delivery outperforms either approach alone.

Content-Addressed vs. Location-Addressed Delivery

The fundamental difference between IPFS and CDN delivery lies in how content is identified and located.

In location-addressed delivery (traditional CDN), the URL https://cdn.example.com/images/hero.png specifies where the content lives. The CDN uses DNS routing to direct the request to the nearest edge server, which either serves the file from its local cache or fetches it from the origin. The content at this URL can change at any time—the CDN must implement cache invalidation mechanisms to handle updates.

In content-addressed delivery (IPFS), the CID bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oc... specifies what the content contains. The CID is a cryptographic hash of the file contents, meaning any node on the network can verify it has the correct file by re-computing the hash. Content at a given CID can never change—it is immutable by construction.

CDN vs IPFS Content Delivery Models Traditional CDN Location-Addressed IPFS + CDN Gateway Content-Addressed Client GET /images/hero.png Edge Cache Hit? Content may have changed! Revalidate: If-None-Match ETag / Last-Modified Cache can be STALE Client GET /ipfs/bafy...abc Edge Cache Hit? CID = content hash! No revalidation needed: hash IS the content Cache FOREVER valid
Figure 1: Location-addressed CDN delivery requires cache revalidation; content-addressed IPFS caching is inherently immutable

CDN IPFS Gateway Architecture

When a CDN operates an IPFS gateway, it translates HTTP requests into IPFS content lookups, caches the results at edge servers, and serves subsequent requests from its traditional caching infrastructure. The gateway architecture has four layers.

Performance Comparison: Edge vs Origin Processing
Metric Edge Processing Origin Processing Improvement
Latency (p50)8–15 ms120–300 ms15–20x faster
Cache Hit Ratio85–95%N/AReduces origin load
TLS Handshake1–5 ms (nearby PoP)50–150 ms10–30x faster
Bandwidth Cost$0.01–0.04/GB$0.05–0.12/GB3–5x cheaper
Availability99.99% (multi-PoP)99.9% (single DC)10x fewer outages

HTTP Request Translation

The CDN edge server receives standard HTTP requests and parses the IPFS path. Two URL schemes are common: path-style (https://gateway.example.com/ipfs/CID) and subdomain-style (https://CID.ipfs.gateway.example.com). The subdomain style provides origin isolation for browser security (each CID gets its own web origin), which matters for IPFS-hosted web applications that use cookies or localStorage.

Content Discovery and Retrieval

If the content is not in the edge cache, the gateway queries the IPFS DHT (Distributed Hash Table) to find peers that hold the requested CID. DHT resolution can take 100 milliseconds to several seconds depending on network conditions and content popularity. The gateway maintains persistent connections to well-known pinning services and frequently-accessed IPFS nodes to reduce discovery latency for popular content.

Verification and Caching

After retrieving content from the IPFS network, the gateway verifies the CID by recomputing the cryptographic hash. If verification passes, the content is cached at the edge with an effectively infinite TTL—content-addressed data never changes, so cache invalidation is unnecessary. This eliminates the cache coherency overhead that dominates traditional CDN architectures.

Response Formatting

The gateway serves the verified content over HTTP with appropriate headers. For IPFS content, the gateway sets Cache-Control: public, max-age=31536000, immutable since CID-addressed content never changes. For IPNS-resolved content, the gateway sets a shorter TTL matching the IPNS record lifetime.

# Nginx configuration for IPFS gateway at CDN edge
location ~ ^/ipfs/(?<cid>[a-zA-Z0-9]+)(?<path>/.*)? {
    # Check edge cache first (CID-based cache key)
    proxy_cache ipfs_cache;
    proxy_cache_key "$cid$path";
    proxy_cache_valid 200 365d;

    # Cache immutable content aggressively
    add_header Cache-Control
        "public, max-age=31536000, immutable";
    add_header X-IPFS-Path "/ipfs/$cid$path";
    add_header X-Content-Verified "true";

    # Fallback to IPFS gateway daemon
    proxy_pass http://127.0.0.1:8080;
    proxy_read_timeout 30s;
    proxy_connect_timeout 10s;
}

# IPNS resolution with shorter cache
location ~ ^/ipns/(?<name>[a-zA-Z0-9._-]+)(?<path>/.*)? {
    proxy_cache ipns_cache;
    proxy_cache_key "$name$path";
    proxy_cache_valid 200 5m;

    add_header Cache-Control "public, max-age=300";
    proxy_pass http://127.0.0.1:8080;
}

Hybrid Architecture Patterns

IPFS Origin, CDN Edge

The most common hybrid pattern uses IPFS as the origin layer and a traditional CDN for edge delivery. Content is published to IPFS (pinned on reliable nodes), and the CDN gateway caches it at edge PoPs after the first request. This combines IPFS’s content integrity guarantees with CDN performance characteristics: sub-10ms edge cache hits, geographic load balancing, and DDoS protection.

The key advantage over a traditional CDN origin is cache invalidation simplicity. When content is updated, a new CID is generated. The CDN never needs to purge old content—the old CID remains valid and cached, while the new CID triggers a new cache fill from IPFS. This eliminates the cache purge propagation delays that complicate traditional CDN cache management.

DNSLink Integration

DNSLink bridges traditional domain names with IPFS content by using DNS TXT records. A TXT record at _dnslink.example.com contains the IPNS name or CID for the domain’s content. CDN gateways resolve DNSLink records to serve IPFS content under standard domain names, making IPFS-hosted websites accessible without users knowing IPFS is involved.

# DNSLink DNS record
_dnslink.example.com. 300 IN TXT
    "dnslink=/ipns/k51qzi5uqu5dh..."

# Alternative: direct CID link (static site)
_dnslink.example.com. 300 IN TXT
    "dnslink=/ipfs/bafybei..."

IPFS Pinning at CDN Edge

CDN providers offering IPFS pinning store content on their edge infrastructure, making it available to both IPFS peers (via the IPFS protocol) and HTTP clients (via the gateway). This dual-protocol availability means content pinned at a CDN edge node is accessible through the decentralized IPFS network and through the CDN’s optimized HTTP delivery path simultaneously.

Performance Characteristics

The performance gap between pure IPFS delivery and CDN-cached IPFS delivery is substantial and explains why hybrid architectures dominate production deployments.

First-request latency for uncached IPFS content ranges from 200 milliseconds to 5 seconds, dominated by DHT content discovery. The CDN gateway’s persistent connections to major pinning services and IPFS indexer nodes reduce this to 50 to 500 milliseconds for well-pinned content. After the first request, edge cache hits serve in under 5 milliseconds—identical to traditional CDN performance.

Bandwidth efficiency improves dramatically with CDN caching. IPFS peer-to-peer transfers are limited by the uploading peer’s bandwidth, which is often a residential connection with 10 to 50 Mbps upload capacity. CDN edge servers serve cached IPFS content at the edge server’s full bandwidth capacity, typically 10 to 100 Gbps per PoP.

Reliability is where the hybrid model excels. If the original IPFS peer goes offline, CDN-cached content remains available as long as the cache is warm. And because content-addressed caching has no expiration, CDN caches can retain IPFS content indefinitely, providing availability guarantees that pure IPFS cannot match without extensive pinning infrastructure.

Use Cases for IPFS-CDN Integration

Static Website Hosting

IPFS combined with CDN gateways provides a compelling static site hosting architecture. The site is published to IPFS as a directory DAG, pinned on reliable nodes, and served through CDN gateways under a standard domain (via DNSLink). Updates create new CIDs and update the IPNS or DNSLink record. The CDN handles TLS termination, HTTP/2-3 delivery, and edge caching. The result is a censorship-resistant website with CDN-grade performance.

NFT and Digital Asset Metadata

NFT metadata and media files stored on IPFS benefit from CDN gateway caching. When an NFT marketplace displays thousands of items, each requiring metadata and image retrieval from IPFS, pure IPFS performance creates unacceptable page load times. CDN gateways cache frequently accessed NFT assets at edge nodes, reducing metadata fetch times from seconds to milliseconds while maintaining the content integrity guarantees that NFT provenance requires.

Software Distribution

IPFS content addressing provides built-in integrity verification for software packages and container images. CDN gateways accelerate distribution while preserving the ability for clients to independently verify downloads against published CIDs. Package registries like npm and container registries like Docker Hub can publish CIDs alongside traditional download URLs, allowing clients to verify integrity regardless of which delivery path they used.

Archival Content

Archives, datasets, and historical records benefit from IPFS’s immutability guarantees. Content-addressed archival storage ensures documents cannot be silently modified, while CDN gateway caching provides responsive access. The combination is particularly valuable for government records, academic datasets, and legal documents where tamper-evidence is as important as availability.

The convergence of IPFS and CDN infrastructure reflects a broader trend in content delivery: the most resilient and performant architectures will combine decentralized storage guarantees with centralized delivery optimization. CDN operators who integrate IPFS gateway capabilities position themselves to serve the growing ecosystem of content-addressed applications while maintaining the performance standards their customers expect.

External References

References & Standards: RFC 7234 · HTTP/2 specification