How do I create a route that opens an external file? How do I create a route that opens an external file?
As an example I have an XML file in my S3 bucket. I need to create a route to open that file from my website.
Is there a way to achieve this without calling a controller? Can I just set a property in the .routing.yml file for this?
my_module.index:
path: '/file.xml'
defaults:
  _controller: 'Drupal\my_module\Controller\moduleController::view'
  _title: 'file View'
requirements:
  _permission: 'access content'
Is there a way to achieve this without calling a controller from the route file?


No, a route needs a controller, no exceptions. If you can find an existing controller/method that does what you need, reliably, then you should use that. If not, you'll need your own controller and method.