I'm noticing numerous common API queries, including those used by search suggestions on MobileFrontend, to not enjoy any form of CDN caching.
- View https://en.m.wikipedia.org/wiki/Main_Page
- Open network devtools.
- Type letter "B".
Latency is 254ms (!)
cache-control: private, must-revalidate, max-age=0 x-cache: cp3050 miss, cp3058 pass x-cache-status: pass
Compared to the equivalent query issued by Vector:
https://en.wikipedia.org/w/api.php?action=opensearch&format=json&formatversion=2&search=B&namespace=0&limit=10
Latency is just 11ms.
cache-control: max-age=10800, s-maxage=10800, public x-cache: cp3058 miss, cp3058 hit/135 x-cache-status: hit-front
To narrow this down, I have confirmed this to be the case even when:
- client is logged out and has no session (e.g. private browsing), although CDN cache should work for search suggestions even when logged-in (like it always has for OpenSearch as used by Vector, etc.).
- when checking appserver response directly, it's not a bug in Varnish or other routing/traffic layers.
- when querying without any of the more complex extensions like PageImages etc. Even a plain prefixsearch with generator enabled for basic pageinfo, reproduces the same bug locally.
$ curl -i 'http://localhost:8080/w/api.php?action=query&format=json&formatversion=2&generator=prefixsearch&gpssearch=B'
HTTP/1.1 200 OK
Server: Apache/2.4.38 (Debian)
Cache-Control: private, must-revalidate, max-age=0
..
{"batchcomplete":true,"query":{"pages":[{"pageid":8,"ns":0,"title":"Bar","index":1}]}}$ curl -i 'http://localhost:8080/w/api.php?action=opensearch&format=json&formatversion=2&search=B&namespace=0&limit=10' HTTP/1.1 200 OK Server: Apache/2.4.38 (Debian) Cache-Control: max-age=1200, s-maxage=1200, public .. ["B",["Bar"],[""],["http://mw.localhost:8080/wiki/Bar"]]