I know that you are asking for expert answers, I'm just a neophyte, and this is my opinion why a server proxy is not a proper final solution:
- Building a proxy server on the server side is not as simple as not creating it at all.
- Not always possible, as in third-party widgets JS. You do not want all your publishers to declare a DNS register for integrating your widget. And change the
document.domain your pages to collage problems. - As I read in a third-party Javascript book, "it requires downloading an intermediate tunnel file before it can perform cross-domain requests." At least you put JSONP in a game with more complex juggling.
- IE8 is also not supported, also from the aforementioned book: "IE8 has a rather strange error that prevents the top-level domain from communicating with its subdomain, even when they both select into a common domain namespace."
- There are several security issues that people have explained in other answers, even more than them, you can check section 4.3.2 Messaging using subdomain proxies from the above book.
And most importantly for me:
- This is a hack .. as a JSONP solution, this is the time for a standard, reliable, safe, clean and convenient solution.
But, after re-reading your question, I think I still haven't answered it, so why is this AJAX secure? , again, I think the answer is this:
Since you do not want any web page you visit to be able to make calls from your desktop to any computer or server on an office intranet
fguillen
source share