Skip to content

Commit 945ae38

Browse files
authored
Merge pull request #429 from kraemer-igroup/Disable-cache-for-EXTcrawler-indexing-requests
Disable cache for EXT:crawler indexing requests
2 parents 98e5919 + 268f291 commit 945ae38

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SFC\Staticfilecache\Cache\Listener;
6+
7+
use SFC\Staticfilecache\Event\CacheRuleFallbackEvent;
8+
9+
/**
10+
* T3Crawler Indexing process.
11+
*/
12+
class T3CrawlerIndexingProcessListener
13+
{
14+
public function __invoke(CacheRuleFallbackEvent $event): void
15+
{
16+
if ($event->getRequest()->hasHeader('X-T3Crawler')) {
17+
$event->addExplanation(__CLASS__, 'T3Crawler Indexing request');
18+
$event->setSkipProcessing(true);
19+
}
20+
}
21+
}

Configuration/Services.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ services:
5252
identifier: 'SolrIndexingProcessListenerFallback'
5353
event: SFC\Staticfilecache\Event\CacheRuleFallbackEvent
5454

55+
SFC\Staticfilecache\Cache\Listener\T3CrawlerIndexingProcessListener:
56+
tags:
57+
- name: event.listener
58+
identifier: 'T3CrawlerIndexingProcessListenerFallback'
59+
event: SFC\Staticfilecache\Event\CacheRuleFallbackEvent
60+
5561
SFC\Staticfilecache\Cache\Listener\ValidRequestMethodListener:
5662
tags:
5763
- name: event.listener

Documentation/Configuration/Htaccess.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ variables (SFC_ROOT, SFC_GZIP) and read the comments carefully.
3131
RewriteCond %{HTTP:X-Tx-Solr-Iq} .+
3232
RewriteRule .* - [E=SFC_HOST:invalid-host]
3333
34+
# Disable cache for EXT:crawler indexing requests
35+
RewriteCond %{HTTP:X-T3Crawler} .+
36+
RewriteRule .* - [E=SFC_HOST:invalid-host]
37+
3438
# Important Note for scheme and port. TYPO3 handle Reverse proxies by respect
3539
# X-Forwarded-For headers. The Apache do not know this configuration. If there
3640
# is a reverse proxy that e.g. terminate SSL and all requests are "http", please

Documentation/Configuration/Nginx.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ By the following configuration:
7070
return 405;
7171
}
7272
73+
# Disable cache for EXT:crawler indexing requests
74+
if ($http_x_t3crawler) {
75+
return 405;
76+
}
77+
7378
charset utf-8;
7479
default_type text/html;
7580
try_files /typo3temp/assets/tx_staticfilecache/${scheme}_${host}_${server_port}${uri}/index

0 commit comments

Comments
 (0)