However, that's not what you appear to discuss in your question.
What you are asking about seems to be whether it's possible to have the server "react" to some (unspecified here) condition by showing either "document X" or "document Y" in a modal in a larger web page. (Keeping in mind that a web page "modal" is really a web page, client construct; it's only modal insofar as something in the web page itself makes the other parts of the web page inaccessible while the modal is being displayed.)
Which, of course, is also possible. But since the server is making the selection, it can't be front-end, because front-end is generally in these contexts taken to mean something done by the client. Which, when considering web pages, will typically but not always be a web browser.
To do what you are asking, the two obvious options are to either include the raw file contents in the larger page using whatever means your web development stack provides for that, or include the URL to one page or another as a document reference (for example for an
<iframe> source). In the former case the contents of that file must fit appropriately wherever it gets included; in the latter case, the page referenced must be a complete web page in its own right.
No front-end logic required.