Can client-side JavaScript use native HTTP proxies?

My server, server.example.com, is not accessible from the Internet. However, there is an available HTTP proxy, proxy.example.com, which can talk to the server.

If users configure their browser to access through proxy.example.com for * .example.com or use the autoconfig proxy file that I provide, they can access the server (after authentication with the proxy server). I want them not to go through this manual process.

Is it possible to do this programmatically? JavaScript will be served from www.example.com, so there seems to be no security issue that would make this impossible in principle.

My limitation is that proxy.example.com is an HTTP proxy server and I cannot touch it. I only manage server.example.com and www.example.com, and my web application can only be run on server.example.com.

+3
source share
2 answers

No, but...

This is not possible in the way you requested it. However, the same can be done using the iframe, which opens the address of the proxy server the URL . In your example, you need to call the following address (if your proxy allows a chain of URLs)

http://proxy.example.com/http://server.example.com

Hope this helps.

amuses michael

+6
source

No, you cannot install a proxy using Javascript.

,

Javascript. .

+2

All Articles