Add tests and implementation for no-cache handling

Fixes https://phabricator.wikimedia.org/T78439
This is causing the query to return a 404.