(Copied comment T69015#2248241 by @BBlack)
We should probably look at aligning the varnish mobile-related redirect/rewrite with these changes as well, to avoid gratuitous redirects and rewrites. There are two separate areas in the VCL where this stuff is affected in different ways:
- The mobile-redirect code:
- Detects requests to Desktop hostnames with Mobile UAs and no mobile-redirect-suppressing cookie, and then redirects them to a mobile hostname.
- code: https://github.com/wikimedia/operations-puppet/blob/production/templates/varnish/text-frontend.inc.vcl.erb#L19
- Specifically the 3x set req.http.MobileHost regex lines (lines 34-36 currently), they seem to, for some projects at least, redirect e.g. www.$project to m.$project for mobile UAs, which is the inverse of the apache rules above...
- The mobile-rewrite code:
- Varnish rewrites mobile hostnames to equivalent desktop hostnames
- It adds X-Subdomain along the way to signal to MobileFrontend that this is a mobile view.
- This is all in cluster_fe_recv_pre_purge, starting currently around line 78
- If www.$project is meant to be a desktop view (of HTML that happens to be mobile-friendly, as opposed to MFE), then we should stop doing the hostname-rewrite + X-Subdomain logic on the www names
- (and the m-dot names too, if they're just going to be apache redirects to the www names).