Course contentsShow
← React
Lesson 1671 of 2,39640. Server-Side RenderingFree lesson

Streaming SSR Browser Support and Fallbacks

Review browser compatibility for streaming responses and fallback strategies for environments that require complete buffers.

Streaming SSR Browser Support and Fallbacks

You'll learn: How to handle browser compatibility issues when implementing streaming SSR and what to do when streaming isn't supported.

The Compatibility Reality

While streaming SSR offers significant performance benefits, not all browsers and environments support streaming responses equally. Modern browsers (Chrome, Firefox, Safari, Edge) all support HTTP streaming natively, but older browsers and certain network conditions can interfere with incremental HTML delivery.

The key compatibility concerns:

  • Older browsers may not handle streamed responses properly
  • Some proxies and CDNs buffer responses before sending them
  • HTTP/1.0 connections don't support chunked encoding
  • Mobile networks sometimes force buffering for optimization

Fallback Strategies

When streaming isn't supported, React's renderToPipeableStream gracefully degrades. You control this behavior through the onAllReady callback—if you wait for it instead of onShellReady, you're essentially falling back to buffered rendering.

The pattern: Detect the environment or user-agent, then choose your callback:

// Streaming-capable environments
if (supportsStreaming) {
  stream.pipe(response, { onShellReady: () => {} });
}

// Fallback for older environments
else {
  stream.pipe(response, { onAllReady: () => {} });
}

Some frameworks handle this automatically—they'll stream to modern browsers but buffer the entire response for older clients or problematic proxies. The HTML output is identical; only the delivery mechanism changes.

Think of it like: Streaming is like a chef serving courses as they're ready, while the fallback is waiting until the entire meal is plated. Both deliver the same food; one just feels faster.

Key Takeaway: Streaming SSR works across modern browsers, but you should implement fallbacks using onAllReady for environments that require complete buffers—the HTML stays the same, only the delivery timing changes.