Closed petetak closed 5 years ago
Which "driver" do you use? And what's the behaviour of your edge cache? Do you ignore queries strings there?
We use Cloudflare. On Cloudflare we have a blacklist that we can add certain things to like google utm links or other email software ids
I'm not happy with the Upper 1.x code base (2.x is WIP and consider to integrate it). There is no nice way to do it, but this workaround should work for you:
<?php
// config/app.php
return [
'modules' => [
// ...
],
'bootstrap' => [
function () {
\yii\base\Event::on(
\ostark\upper\Plugin::class,
\ostark\upper\Plugin::EVENT_AFTER_SET_TAG_HEADER,
function (\ostark\upper\events\CacheResponseEvent $event) {
// manipulate requestUrl
$event->requestUrl = preg_replace( '/&?utm_.+?(&|$)$/', '', $event->requestUrl );
},
null,
false
);
}
]
];
Please let me know if this works for you.
Thanks!
On 12 Mar 2019, at 20:29, Oliver Stark notifications@github.com wrote:
I'm not happy with the Upper 1.x code base (2.x is WIP and consider to integrate it). There is no nice way to do it, but this workaround should work for you:
<?php
// config/app.php
return [
'modules' => [ // ... ], 'bootstrap' => [ function () { \yii\base\Event::on( \ostark\upper\Plugin::class, \ostark\upper\Plugin::EVENT_AFTER_SET_TAG_HEADER, function (\ostark\upper\events\CacheResponseEvent $event) { // manipulate requestUrl $event->requestUrl = preg_replace( '/&?utm_.+?(&|$)$/', '', $event->requestUrl ); }, null, false ); } ]
]; — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
@petetak does it work for you?
Is there a config option or a way to prevent query string parameters from creating a new entry in the upper_cache table please?
My table is getting full of duplicates and therefore takes much longer to clear.