drupal 8 pass variable to controller without seting it tourl code example
Example: drupal 8 routing parameters
example.user:
path: '/example/{user}'
defaults:
_controller: '\Drupal\example\Controller\ExampleController::content'
requirements:
_permission: 'access content'
options:
parameters:
user:
type: entity:user