(Extracted from T138093)
## Steps
[x] Roll out libvmod-querysort package to varnishes.
[x] Enable query-sorting in Beta Cluster varnish.
[x] Enable query-sorting in production via `X-Wikimedia-Debug`.
[x] Set `$wgCdnMatchParameterOrder = false` on Beta. Test.
[x] Cherry-pick [[ https://gerrit.wikimedia.org/r/c/mediawiki/core/+/820905 | I3c52ca47e ]] to deployment branches.
[x] Set `$wgCdnMatchParameterOrder = false` on testwiki.
[ ] Enable querysort on testwiki.
[ ] Set `$wgCdnMatchParameterOrder = false` on mediawiki.org.
[ ] Enable querysort on mediawiki.org.
[ ] Set `$wgCdnMatchParameterOrder = false` everywhere.
[ ] Incrementally enable querysort for all domains (T138093#8117992).
## Monitoring
* [[ https://grafana.wikimedia.org/d/000000541/varnish-caching-last-week-comparison | Varnish Caching Last Week Comparison ]]
* [[ https://grafana.wikimedia.org/d/000000500/varnish-caching | Varnish Caching ]]
## Testing
#### MediaWiki
`$wgCdnMatchParameterOrder` test script: P32345 (run on mwdebug)
Checking `Cache-Control` header from an app server:
```
$ curl -s -i --connect-to ::$HOSTNAME -H 'X-Forwarded-Proto: https' 'https://test.wikipedia.org/w/index.php?action=history&title=Main_Page' | grep -i cache-control
Cache-Control: private, must-revalidate, max-age=0
```
//(should be `Cache-Control: s-maxage=1209600, must-revalidate, max-age=0` once a87177564 is deployed)//
#### Varnish
```lang=sh
# Initial request is a cache miss (this may vary, obviously):
$ curl -si 'https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Hobby&action=history' | grep -i x-cache
x-cache: deployment-cache-text06 miss, deployment-cache-text06 miss
x-cache-status: miss
# Subsequent request is a cache hit:
$ curl -si 'https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Hobby&action=history' | grep -i x-cache
x-cache: deployment-cache-text06 miss, deployment-cache-text06 hit/1
x-cache-status: hit-remote
# Subsequent request, now with sorted query parameters, should also be a hit:
$ curl -si 'https://en.wikipedia.beta.wmflabs.org/w/index.php?action=history&title=Hobby' | grep -i x-cache
x-cache: deployment-cache-text06 miss, deployment-cache-text06 hit/2
x-cache-status: hit-remote
```