Hi team -
There was a question yesterday if we had caching headers in the APIs
consumed by the apps.
I did a quick cURL on a couple URLs for Android and iOS and it seems like
maybe requests are served cold from the Varnish cache (as with many API
responses), even if there may be some memcached/Redis hot storage at the
web server for the underlying content.
Does anyone know if there's a safe approach to implement caching headers
(e.g., Cache-Control, Expires, ETag, etc.) to optimize for hot cache hits
for the API endpoints used by the apps and experimental webapps? In
particular, would we benefit from doing so on action=mobileview? Is there a
way to canonicalize the request parameters to increase the odds of a cache
hit regardless of whether iOS or Android made the first hit (either
client-side or perhaps at the edge with scare VCL)? What about for other
API endpoints?
-Adam
$ curl -s -D - "
http://en.m.wikipedia.org/w/api.php?action=mobileview&format=json&p…
-o /dev/null | grep -v GeoIP
HTTP/1.1 200 OK
Server: Apache
X-Powered-By: HHVM/3.6.1
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding,X-Forwarded-Proto,Cookie
Content-Type: application/json; charset=utf-8
X-Varnish: 2886917462, 1761146385
Via: 1.1 varnish, 1.1 varnish
Transfer-Encoding: chunked
Date: Wed, 03 Jun 2015 13:20:08 GMT
Age: 0
Connection: keep-alive
X-Cache: cp1046 miss (0), cp1046 frontend miss (0)
Set-Cookie: WMF-Last-Access=03-Jun-2015;Path=/;HttpOnly;Expires=Sun, 05 Jul
2015 12:00:00 GMT
Cache-Control: private, s-maxage=0, max-age=0, must-revalidate
$ curl -s -D - "
https://en.m.wikipedia.org/w/api.php?action=mobileview&format=json&…
-o /dev/null | grep -v GeoIP
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Wed, 03 Jun 2015 13:22:23 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: HHVM/3.6.1
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding,X-Forwarded-Proto,Cookie
X-Varnish: 2583358918, 1834266080
Via: 1.1 varnish, 1.1 varnish
Age: 0
X-Cache: cp1047 miss (0), cp1060 frontend miss (0)
X-Analytics: https=1
Set-Cookie: WMF-Last-Access=03-Jun-2015;Path=/;HttpOnly;Expires=Sun, 05 Jul
2015 12:00:00 GMT
Cache-Control: private, s-maxage=0, max-age=0, must-revalidate