You can define parameter for that. In app/config/config.yml
define:
parameters:
httpProtocol: http
Then in app/config/config_prod.yml
:
parameters:
httpProtocol: https
And in routing.yml
change to:
myBundle:
resource: "@MyBundle/Controller/"
type: annotation
prefix: /
schemes: ['%httpProtocol%']
Clear the cache (both prod and dev) and it should work.