Skip to content
Snippets Groups Projects
Commit 9b25314b authored by Vojislav Jovanovic's avatar Vojislav Jovanovic
Browse files

Issue #3453992: Update list of paths to ignore

parent 52b96c47
No related branches found
No related tags found
1 merge request!3Update list of paths to ignore
......@@ -133,17 +133,29 @@ class RateLimitManager implements RateLimitManagerInterface {
// Some page requests trigger additional request which should not be
// counted towards the limit. Such requests are ignored.
// Image module: generate image derivatives of publicly available files.
// - path: /[file_public_path]/styles/ (e.g. /sites/default/files/styles)
// - path: public://styles/ (e.g. /sites/default/files/styles)
// Image module: generate image derivatives of private files.
// - path: /system/files/styles/
// System module: generate optimized CSS/JS asset files.
// - Drupal 10.0 and lower: public://css and public://js
// - Drupal 10.1 and higher: assets://css and assets://js
// History module: mark a node as read by the current user.
// - path: /history/{node}/read (e.g. /history/18/read)
// Contextual Links module: render contextual links.
// - path: /contextual/render
// Media module: render an oEmbed resource.
// - path: /media/oembed.
$styles_public = PublicStream::basePath() . '/styles/';
$pattern = "@($styles_public)|(/system/files/styles/)|(/history/\d+/read)|(/contextual/render)|(/media/oembed)@";
$public_stream = PublicStream::basePath();
$stream_wrappers = "($public_stream)";
// phpcs:disable
if (class_exists('\Drupal\Core\StreamWrapper\AssetsStream')) {
$assets_stream = \Drupal\Core\StreamWrapper\AssetsStream::basePath();
if ($public_stream !== $assets_stream) {
$stream_wrappers .= "|($assets_stream)";
}
}
// phpcs:enable
$pattern = "@$stream_wrappers|(/system/files/styles/)|(/history/\d+/read)|(/contextual/render)|(/media/oembed)@";
if (preg_match($pattern, $request->getRequestUri())) {
return FALSE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment