[5.x] Prevent query parameters bloating the static cache#10701
Conversation
… into static-caching-query-params
|
Rather than a new method in the manager class, I've made the This allows the URL to work differently per cacher. A related issue I noticed while working on this is that since the query string gets alphabetized by Symfony/Laravel, when you use full measure, the generated filename might be different than what you visit. So, in the file cacher's |
* Nocache database driver Related: statamic/cms#10671 * Prevent query parameters bloating the static cache Related: statamic/cms#10701 * Add entry password protection Related: statamic/cms#10800 * Fix small typo Related: statamic/cms#10824 * Move nocache js back to end of body but make configurable Related: statamic/cms#10898
This pull request adds a few configuration options to the
static_caching.phpconfig file, allowing specifing which query parameters should be allowed/disallowed.This PR doesn't change the output of Laravel's
$request->getUri()orURL::getCurrent()methods. If you need the "normalized" static caching URL, you should callStaticCache::currentUrl().Note
It's worth noting that while these config options may partially work with full-measure static caching, they're intended for use with half-measure static caching.
New Config Options
allowed_query_parametersfooquery parameter allowed, and visit/contact?foo=bar&david=hasselhoff, it'll serve/write the cached page for/contact?foo=bar.disallowed_query_stringsdavidquery param disallowed, and visit/contact?foo=bar&david=hasselhoff, it'll serve/write the cached page for/contact?foo=bar.