The [host rewrite for /static/](https://github.com/wikimedia/operations-puppet/blob/87a3e318590503648879deb53f05dd258444331b/templates/varnish/text-frontend.inc.vcl.erb#L130) is only applied to regular requests, but not to PURGEs. This means that purges for paths in /static/ using any domain but $static_host = 'en.wikipedia.org' will silently fail.
Description
Details
Related Objects
- Mentioned In
- T126934: Roll out Restbase to production
Event Timeline
Change 279564 had a related patch set uploaded (by GWicke):
WIP: Rewrite /static/ also for PURGE requests
Note, there is a script to work around this on deployment of /static/ stuff, on the deployment hosts. But we should still circle back around and fix this after codfw switchover week...
Change 644466 had a related patch set uploaded (by Ema; owner: Ema):
[operations/puppet@production] vcl: move /static Host normalization to cluster_fe_recv_pre_purge
Change 279564 abandoned by Ema:
[operations/puppet@production] [untested] Rewrite /static/ also for PURGE requests
Reason:
Obsoleted by various architectural changes (eg: there's no backend/common anymore), see https://gerrit.wikimedia.org/r/c/operations/puppet/ /644466/ instead
Change 644466 merged by Ema:
[operations/puppet@production] vcl: move /static Host normalization to cluster_fe_recv_pre_purge
I tried a test purge on cp3054:
curl -v -X PURGE -H "Host: fr.wikipedia.org" http://127.0.0.1/static/ema-test
And indeed varnish is now doing the Host header rewrite as expected:
15:11:31 ema@cp3054.esams.wmnet:~ $ sudo varnishlog -n frontend -q 'ReqMethod eq "PURGE" and ReqURL eq "/static/ema-test"' - ReqMethod PURGE - ReqURL /static/ema-test - ReqProtocol HTTP/1.1 - ReqHeader Host: fr.wikipedia.org [...] - ReqUnset Host: fr.wikipedia.org - ReqHeader Host: en.wikipedia.org - VCL_acl MATCH local_host "127.0.0.1" - VCL_return purge - VCL_call HASH - VCL_return lookup - VCL_call PURGE - VCL_return synth - Timestamp Process: 1607008355.422327 0.000091 0.000091 - RespProtocol HTTP/1.1 - RespStatus 204
Further I've verified that the static object cached for a GET request with Host: fr.wikipedia.org is purged when purging the same object with Host: de.wikipedia.org. Closing.