During development it is important to make sure not exploiting any kind of security issues. Here we are going to see how can secure server details without showing to public users while handling an exception.
In this example we have a custom menu callback which will process the argument which we are passing with the url. We will pass media id(mid) with the url and it will force prompt download corresponding the media file.
Define custom menu callback: custom_module.routing.yml