Status quo
See also RFC: Mobile domain sunsetting § Infra cost on mediawiki.org.
- The CDN (Varnish/ATS) respond to requests on mobile subdomains, with a mobile version.
- They store this response under that URL as-is.
- This means the standard copy and mobile copy are cached under different URLs and thus has historically required MediaWiki to emit twice as many purges to the CDN (for both URLs) after every edit and links update.
- Historically the reason for this was that MobileFrontend did not emit Vary:X-Subdomain from its backend responses. This was fixed in T390929.
The way this works today:
- Varnish handles requests to the mobile subdomain by:
- computing the standard domain (e.g. strip the "m") and store it in the temporary x-dt-host. This is ignorede by Varnish itself, and the request hostname (e.g. "en.m.wikipedia.org") is left unchanged, as was historically needed to ensure mobile versions have a separate cache instead of poisoning the desktop cache.
- After cache miss, Varnish frontend fetches from ATS backend.
- ATS leaves the request unchanged during cache lookup, for the same reason (lack of Vary:X-Subdomain).
- After cache miss, ATS fetches from MediaWiki.
- Before performing that fetch, it sets Host = x-dt-host via our rb-mw-mangling.lua plugin.
- MediaWiki has a hook for MobileFrontend, which modifies the purge list to add a duplicate of each purge command with the hostname swapped for the mobile subdomain.
Acceptance criteria
- One cache: Varnish and ATS should not maintain separate caches for mobile domain and unified mobile routing.
- One purge: MediaWiki doesn't send duplicate purges for the mobile domain.
Option A: Share CDN cache now, redirect later
- Copy Host = x-dt-host assignment from ATS to Varnish, behind a feature flag.
- Move MobileFrontend purging hook, currently in wmf-config, behind a feature flag.
- Rollout to Beta Cluster and testwikis
- Rollout to production on the same wikis that enable unified mobile routing:
- Turn on Varnish feature flag. This will essentially clear the m-dot cache and make it use the unified cache instead. At this point purges from MediaWiki for the mobile domain are redundant.
- Turn on the MW feature flag to stop MobileFrontend sending purges to the mobile domain.










