views:

23

answers:

0

So here's the deal: there is a proxy service which I access by appending a string to the domain. So for example, to access foo.com through the bar proxy, I go to foo.com.bar.com.

I'm then directed to a web-based authentication form which offers me the chance to choose a domain, and then authenticate by certificate or by password. After choosing one, I'm redirected to the original site (through the bar.com proxy).

I'd like to set up a proxy server to mirror this--so for example, I'd like to be able to go to baz.com/foo.com and then interact with foo.com as though I'd accessed it through the bar.com proxy (but transparently, without having to enter a password or do authentication or anything like that).

The root of my question is this: I don't quite have a good enough grasp of how proxy servers work to know how I can shuttle raw requests back and forth. For example, I know I could use a web framework to write a simple application that takes a route baz.com/foo.com and then accesses and logs into the bar.com proxy and gets the page, but I'm not totally solid on how I simply pass those packets onto whoever is using baz.com (as opposed to downloading the HTML and assets like CSS and media files myself and passing it onto them).

So after all that rambling: any thoughts or hints about where I should look to do this? It seems that something like nginx is a bit too simple to do this on its own, and it's not clear that I need a full framework (say like Sinatra). Even in the case of a full framework, I don't know the name of what I'm trying to do well enough to look up how to do it (i.e. I'm looking to write a simple web application that acts as a proxy by calling a script to emulate a browser and then pass along the packets it receives?)

Thanks for taking the time to read all that!