Exclude a route from Route::$defaultFlags = Route::SECURED;

Member | 26

Hello There, i have the following router

public function createRouter()
        $router = new RouteList();

        if ($_SERVER["SERVER_NAME"] === 'www.example.com') {
            Route::$defaultFlags = Route::SECURED;

        $router[] = $backendRouter = new RouteList("Admin");
        $backendRouter[] = new Route("admin", "Dashboard:default", Route::ONE_WAY);
        $backendRouter[] = new Route("admin[/<presenter>][/<action>][/<id>]", "Admin:Dashboard:default");

        $router[] = $frontRouter = new RouteList("Supplier");
        $frontRouter[] = new Route("supplier", "Documents:default", Route::ONE_WAY);
        $frontRouter[] = new Route("supplier[/<presenter>][/<action>][/<id>]", "Supplier:Dashboard:default");

        $router[] = new Route('sign-<action>', 'Front:Sign:');

        $router[] = new Route('<presenter>/<action>[/<id>]', 'Front:Sign:homepageRedirect');

        return $router;

I need all the requests that go to


to be excluded from https and be surved via http. (cli is a presenter)

I can “upgrade” my if statement, but i do not think that is the correct way to go…

thanks in advance

Last edited by pistols (2014-11-25 16:43)

Jan Tvrdík
Nette guru | 2547

Route::$globalFlags is a static evil you should have never used. There is AFAIK no way to make an exception.