What are the disadvantages to using a PHP proxy to bypass the same-origin policy for XMLHttpRequest?

StackOverflow https://stackoverflow.com/questions/184028

Question

http://developer.yahoo.com/javascript/howto-proxy.html

Are there disadvantages to this technique? The advantage is obvious, that you can use a proxy to get XML or JavaScript on another domain with XMLHttpRequest without running into same-origin restrictions. However, I do not hear about disadvantages over other methods -- are there, and what might they be?

Was it helpful?

Solution

Overhead - things are going to be a bit slower because you're going through an intermediary.

There are security issues if you allow access to any external site via the proxy - be sure to lock it down to the specific site (and probably specific URL) of the resource you're proxying.

OTHER TIPS

Overhead -- both for the user (who know hsa to wait for you server to make and receive data from the proxied source) and you (as you're now taking on all the traffic for the other server in addition to your own).

Also security concerns -- if you are using a proxy to bypass browser security checks for displaying untrusted content, you are deliberately sabotaging the browser security model -- potentially allowing the user to be compromised -- so unless you absolutely trust the server you are communicating with (that means no random ads, no user defined content in the page[s] you are proxying) you should not do this.

I suppose there could be security considerations, though others are likely to be more qualified than me to address that. I've been running such a proxy on my personal site for a while now and haven't run into problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top