Declaring filters in application config

I’m trying to add a filter into an application config, but there is little documentation about this issue. I have managed to call a filter through the behaviour definition in the web.php like:

      'as derp' => [

            'class' => 'RouteToMyFilter',

            'only' => ['url/defined'],


I am using, as suggested in the note in this url:

But, as you see (the url it’s stupid, I know, but, it’s for testing purpouses only), I have defined a route but the library it’s using the id of the active controller, ignoring any route. Is there any way to define a filter to make it use the routes or the note it’s wrong?