Issue 9303: Detect AP accesses as backend, prevent ping pong

This commit is contained in:
Michael 2020-10-02 09:31:39 +00:00
parent 97f07b7518
commit 73a7df85f7
3 changed files with 25 additions and 5 deletions

View file

@ -134,8 +134,15 @@ class Mode
*/
public function determineRunMode(bool $isBackend, Module $module, array $server, MobileDetect $mobileDetect)
{
$isBackend = $isBackend ||
$module->isBackend();
$contenttypes = ['application/jrd+json', 'application/xrd+xml', 'text/xml',
'application/rss+xml', 'application/atom+xml', 'application/activity+json'];
foreach ($contenttypes as $type) {
if (strpos(strtolower($server['HTTP_ACCEPT'] ?? ''), $type) !== false) {
$isBackend = true;
}
}
$isBackend = $isBackend || $module->isBackend();
$isMobile = $mobileDetect->isMobile();
$isTablet = $mobileDetect->isTablet();
$isAjax = strtolower($server['HTTP_X_REQUESTED_WITH'] ?? '') == 'xmlhttprequest';