3

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.

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.

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.

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.

Adam Morrison
  • 206
  • 3
  • 8

2 Answers2

6

No, but...

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

i hope that helps.

cheers, michael

mschmoock
  • 17,114
  • 5
  • 30
  • 32
2

No, you cannot set the proxy by Javascript.

there doesn't seem to be a security issue

Arbitrary Javascript altering browser settings IS a security issue.

Vlad
  • 9,526
  • 2
  • 30
  • 37
  • The question was whether this could be accomplished for this specific site in some way, not necessarily by setting the global browser setting. – Adam Morrison Aug 09 '11 at 08:29
  • @Adam the http proxy is a global browser setting in all major browsers. **willsteel** gave you a workaround, but that's not standard proxy behaviour. – Vlad Aug 09 '11 at 08:35