Hi, @Foxinthecity. I want to be clear that these forums are primarily used for debugging Netlify itself and not for debugging the code you write or written by third-parties. Now, that said, people often do ask questions about the code they write or third-party code here and sometimes they get answers. However, this is not covered under the technical support scope that the support team at Netlify provides so if you are going to get help with the custom code, it probably will come from others on this forum and not from Netlify itself.
I am also very much confused by this:
Interestingly, this URL works perfectly when accessed within my web app, but when accessed directly outside of the app, it leads to the 404 error.
How can a website be accessed other than by accessing the website? How do you access a website outside of the website?
Are you saying when you click the link on the page it works? If so, that route is likely handled by client side routing. If that is what you mean, this support guide has the solution:
If there are other questions about this, please let us know.