Blueprints per user role causing 503/504 errors

Using this setup to manage different Blueprints based on user roles, I run into the problem, that after some initial fine usage of the website with both roles, from different networks it will load forever and eventually throw a 503, and be completly down.

In My error_log i will get the following output:

[proxy_fcgi:error] [pid 24554] (70007)The timeout specified has expired: [client MyAccessingIP:51365] AH01075: Error dispatching request to : (polling), referer: https://domain.com/panel/login

My index.php:

<?php 

require __DIR__ . '/kirby/bootstrap.php';

$kirby = new Kirby();

$currentUser = $kirby->user();

if ($currentUser && $currentUser->role()->name() === 'vertriebsservice') {
    $kirby = new Kirby([
        'roots' => [
            'blueprints' => __DIR__ . '/site/blueprints/vertriebsservice',
        ],
    ]);
} else  {
    $kirby = new Kirby([
        'roots' => [
            'blueprints' => __DIR__ . '/site/blueprints',
        ],
    ]);
}

echo $kirby->render();

This occures in my Production System (3.5.7.1) aswell as a Fresh Starterkit (3.2.0)
Both PHP 7.3.33 and 8.0.20 have been tested, and have resulted in the same problem.

When using the defaul index.php shipped with Kirby this does not happen.

There is a better way to do this than in index.php, see you load Kirby twice, see Programmable blueprints | Kirby CMS

1 Like

Thank you for the information!
I will look into it, does this work with Kirby 3.5?

No, it needs Kirby 3.6-

Can be done with 3.5 if you use an array instead of the closure.

1 Like

Alright, thanks for the Info.