问题描述
无法从Internet访问我的服务器server.example.com.但是,有一个可访问的HTTP代理proxy.example.com,可以与服务器通信.
My server, server.example.com, isn't accessible from the Internet.However, there's an accessible HTTP proxy, proxy.example.com, that can talk to the server.
如果用户将浏览器配置为通过* .example.com的proxy.example.com进行访问,或者使用我提供的代理自动配置文件,则他们可以访问服务器(在对代理进行身份验证之后).我想避免让他们经历此手动过程.
If users configure their browser to go through proxy.example.com for *.example.com, or use a proxy autoconfig file I supply, they can access the server (after authenticating with the proxy). I want to avoid making them go through this manual process.
是否可以通过编程方式执行此操作?该JavaScript将通过可访问Internet的www.example.com网站提供,因此似乎没有安全性问题,从原则上讲不可能做到这一点.
Is it possible to do this programmatically? The JavaScript will be served from an Internet-accessible www.example.com site, so there doesn't seem to be a security issue which would make this impossible in principle.
我的约束是proxy.example.com是一个HTTP代理,我无法触摸它.我只控制server.example.com和www.example.com,而我的Web应用只能在server.example.com上运行.
My constraint is that proxy.example.com is an HTTP proxy and I cannot touch it. I only control server.example.com and www.example.com, and my web app can only be run on server.example.com.
推荐答案
否,但是...
这不是您要求的方式.但是,使用打开 URL链接代理地址的iframe可以实现相同目的.在您的示例中,您必须调用以下地址(如果您的代理服务器允许URL链接)
This is not possible in the way you asked it. However, the same can be accomplished by using an iframe that opens an address of an URL chaining proxy. In your example, you have to call the following address (if your proxy allows URL chaining)
http://proxy.example.com/http://server.example.com
我希望能帮上忙.
欢呼声,迈克尔
这篇关于客户端JavaScript可以使用其自己的HTTP代理吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!