When the server is down: a fallback ladder for remote UI
Server-driven UIDeep dive7 min readMiniwall team
Part of the series: Server-driven UI: a field guide for app teams
On this page
When a remote screen can't load, the app should step down, not stop. First a fresh answer from the server, then the last copy it saved, then a copy that shipped with the build, then the screen you had before any of this, and finally nothing at all. Each rung costs something to build and keep in step, so most screens need two or three of them, not five. One rule holds on every rung: a failure never stands between a person and paying, or between a person and cancelling.
That answers a fair worry about server-driven UI: you've added a dependency the build didn't have. You have. The work is deciding, per screen, what happens when it fails.
Steps in order, with who does each: Network or On the device.
- Network: 1. Fresh answer, within a time budget
- On the device: 2. Last saved copy
- On the device: 3. Copy shipped with the build
- On the device: 4. The screen you had before
- On the device: 5. Nothing; purchase and cancel still work
Who asked for the screen decides how far down you go
Before the rungs, one question sorts most screens: did the person ask to see this?
If they tapped "Upgrade" or "Cancel subscription", they're waiting. Every second of spinner is visible, and showing nothing would read as a broken button. Those screens deserve the whole ladder.
If you decided to show it (a prompt on page load, a "what's new" card, an offer after the third export), nobody is waiting. Showing nothing costs one impression. Those screens can drop straight from rung 2 to rung 5, and I'd argue they should.
Rung 1: a fresh answer, with a time limit
The happy path has its own failure: slow. A request that never errors but takes ten seconds is worse than one that fails in one, because the person is watching it. So rung 1 needs a timeout, and the number is a product decision. For a screen someone tapped to open, I'd pick something a person would tolerate after a tap, a few seconds at most. For a prompt nobody asked for, a longer wait does little harm, because if it misses the moment you just skip it.
Whatever you choose, the timeout is what moves you to rung 2. Without one, the ladder never starts.
Rung 2: the last copy you saved
HTTP already has words for this. RFC 9111 says a cache "MUST NOT generate a stale response unless it is disconnected or doing so is explicitly permitted by the client or origin server"[1]. RFC 5861 defines two ways to give that permission. stale-while-revalidate lets caches keep serving a stale response "up to the indicated number of seconds" while they revalidate it in the background[2]. stale-if-error lets a stale response stand in when the origin fails, where an error is "any situation that would result in a 500, 502, 503, or 504 HTTP response status code being returned"[2].
Those directives help when a cache that holds a copy sits between the app and the failure, like a CDN in front of an origin that just fell over. They don't help a phone on a train with no signal. Nothing between the phone and your server can answer then. The copy that helps there is the one on the device, which is why client SDKs for remote screens tend to keep their own. We covered how long such a copy should count as fresh, stale or gone in caching remote screens, so here's only the rule that matters for the ladder:
Fall back on 5xx, timeouts and network errors. Don't fall back on 4xx. A 5xx says the server is having a bad day. A 4xx says you asked for the wrong thing: a revoked key, a screen that was deleted, a site that isn't allowed. A saved copy would hide that setup bug for as long as the copy lives, and you'd find out from a confused user instead of from your logs.
Rung 3: a screen that ships with the build
There is no saved copy on a first launch, after a reinstall, or after someone clears site data. A copy bundled with the build covers those cases.
It costs you a second copy of the screen that drifts from the first. On the web it's as old as your last deploy. In a mobile app it's as old as the oldest build people still run, which can be months. Two things keep that drift harmless. Keep prices out of the bundled screen and pass them in by plan ID at render time, so a stale layout can't show a stale price. And keep it plain: if the bundled screen points at images on a server, those won't load in exactly the situation it exists for.
This is the rung I'd skip most often. For a web prompt, a bundled copy rarely earns its upkeep. For a mobile onboarding flow that must run on first launch, offline, it usually does.
Rung 4: the screen you had before
Most teams adopting remote UI already have a working screen: a pricing page, a native paywall, a plain settings page with a cancel link. Keep it. It's in every build, everyone before the switch has already used it, and it's the way back if the remote version misbehaves. Migrating one screen at a time is built around keeping it.
It won't get your changes, so it will look dated next to the remote one. That's fine. It's a floor, not a goal. I'd keep it until you've measured how often rungs 1 to 3 actually fail, and the number is low enough that you'd stop worrying about it. Deleting the floor first is the order I'd avoid.
Rung 5: nothing, and the person carries on
For screens you chose to show, this is the right answer to a failure, and often the second rung, not the fifth. The page works, the app works, and you try again next time.
For screens the person asked for, "nothing" can't mean a dead end. If they tapped "Upgrade" and every rung failed, send them to a checkout or pricing page that doesn't depend on the remote screen. If they tapped "Cancel subscription" and the exit survey won't load, cancel. A cancel survey sits in front of the cancellation, never in place of it, and a broken one must not become a reason someone can't leave.
One more thing that isn't a failure: a decision. If your targeting chose to show this person nothing (they're in a holdout, or they've seen it enough this week), dropping to a bundled screen would quietly override that choice. Fallbacks are for errors only.
When a ladder is overkill
Not every screen needs this. My defaults, as opinions rather than measurements:
| Screen | Rungs | Why |
|---|---|---|
| Prompt you decided to show | 1, 2, 5 | Nobody is waiting; a miss costs one impression |
| Upgrade the person tapped | 1, 2, 4, 5 | They're waiting, and they must still be able to pay |
| Cancel flow | 1, 2, 4, 5 | The cancel must work even when the survey doesn't |
| First-launch onboarding (mobile) | 1, 2, 3, 5 | No saved copy exists yet, often no network either |
| Informational card, changelog | 1, 2, 5 | Stale is fine; missing is fine |
Swipe sideways to see every column.
Sometimes the right answer is that the screen shouldn't be remote. If it changes twice a year, or a failure there would really hurt, put it in the build. The trade-offs post has the longer version of that argument, and if a remote screen is untrusted input for you, the security checklist covers what the renderer should refuse.
A fallback you haven't triggered on purpose is a guess. Block the screen's host on a test device or through a proxy, and walk down each rung once before launch.
The ladder in code
Here's the ladder written against one SDK, ours (@miniwall/web 0.1.0), because it's the one whose failure behaviour we can show exactly. Rungs 1 and 2 are a single call: the SDK asks the network first and uses its saved copy after a timeout, a network failure or a 5xx, and it never replaces a 4xx with a copy[3][4]. A load failure rejects the promise; a targeting decision to show nothing resolves with outcome: 'skipped', so it never reaches the catch.
// @miniwall/web 0.1.0. Typechecked with TypeScript 5.9 against the package's own types.
import { configure, presentPaywall, type PaywallJson, type PresentOptions, type ProductInfo, type PurchaseResult } from '@miniwall/web';
import bundledUpgrade from './upgrade-screen.json'; // rung 3: a screen downloaded from the dashboard
declare function checkout(packageId: string): Promise<boolean>; // your own checkout
configure({ apiKey: 'pk_...', timeoutMs: 3000 }); // rung 1's time budget; the default is 8000
// The person tapped "Upgrade": they asked, so go all the way down.
export async function openUpgrade(products: Record<string, ProductInfo>): Promise<PurchaseResult | 'own_page'> {
const options: Omit<PresentOptions, 'paywall'> = {
products, // prices by package ID, from your code, never from the screen
onPurchase: ({ packageId }) => checkout(packageId),
};
try {
// Rungs 1 and 2: a fresh answer, or the saved copy after a timeout, network failure or 5xx.
return await presentPaywall({ ...options, paywall: { placement: 'upgrade_button' } });
} catch (err) {
console.warn('upgrade screen: remote failed', err); // a 401, 403 or 404 lands here: a setup bug, alert on it
}
try {
return await presentPaywall({ ...options, paywall: bundledUpgrade as PaywallJson }); // rung 3
} catch (err) {
console.warn('upgrade screen: bundled copy failed', err);
}
location.assign('/pricing'); // rung 4: the page you had before
return 'own_page';
}
// A prompt nobody asked for: one try, then rung 5.
export async function maybePromptUpgrade(products: Record<string, ProductInfo>): Promise<void> {
try {
await presentPaywall({ paywall: { placement: 'feature_limit' }, products, onPurchase: ({ packageId }) => checkout(packageId) });
} catch {
// Show nothing. The person carries on.
}
}timeoutMs is set once in configure, so it's one budget for every placement on the page. If your tapped screens and your prompts need different budgets, that's a reason to keep prompts on rung 5 rather than tuning the number for them.
Sources
- IETF, RFC 9111: HTTP Caching (4.2 Freshness, 4.2.4 Serving Stale Responses) (opens in a new tab)rfc-editor.org · accessed
- IETF, RFC 5861: HTTP Cache-Control Extensions for Stale Content (opens in a new tab)rfc-editor.org · accessed
- Miniwall docs, Preload and sources (caching and the offline copy) (opens in a new tab)docs.miniwall.app · accessed
- Miniwall docs, Errors (opens in a new tab)docs.miniwall.app · accessed
- Miniwall docs, Public API (delivery cache headers) (opens in a new tab)docs.miniwall.app · accessed


