The way we handled this in our project was the use of an HTTP handler. We put the clientaccesspolicy.xml file in the _layouts directory (which is shared on sharepoint sites) using the function (you can also just manually copy it there).
Then we added our HTTP handler to the web.config handler section. In our handler, we check if there is a request for /clientaccesspolicy.xml, and if so, we rewrite the path:
if (path.ToLowerInvariant() == "/clientaccesspolicy.xml") { HttpContext.Current.RewritePath("/_layouts/clientaccesspolicy.xml"); }
Iām not sure that this will cost security so that it cannot completely solve your problem. But at least it gives you a way to access this file.
source share