Re: Forward proxies and aliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Tavian Barnes wrote:
>>>
>>> Just an idea from a guy who really knows next to nothing about proxies :
>>> If
>>> - a proxy configuration allows you to selectively forward some requests
>>> to a
>>> selection of sites, but not to a local file
>>> - but what you want to do is to redirect some URLs to a local file
>>>
>>> then can you not set up a local virtual host under some name, and forward
>>> ditto "local" requests to that local virtual host, whose pleasure it
>>> would
>>> be to serve the local stuff in question ?
>>>
>>> André
>>>
>>
>> The thing is, when the browser sends the request to the local virtual
>> host, it's treating it like a proxy server.  So, the local host would
>> have to be able to recognise a proxy request for a certain page, and
>> return a local file instead, which is the same thing I'm trying to do
>> now.
>>
> It's probably me in this case, but I believe one of us is not understanding
> this right.
>
> At the browser level, you are requesting items from www.google.com, and the
> browser is configured to use serverA as a http proxy, right ?

Right.

> And what you want is that the proxy on serverA would get some stuff really
> from www.google.com, but some other stuff it should deliver from local files
> instead, still right ?

Right.

> But that is something you cannot configure easily, because there is no way
> in the proxy to tell it to forward some requests to a http server, but serve
> some other ones from local files.  Still right ?

As far as I can tell.

> So, what I mean is that on the same host hosting serverA, (which you use as
> a http proxy), you also configure a separate serverB (virtual), which can
> deliver some "local" files (if a suitable request URL requests them). (or
> you set up serverB on a totally separate local host, whatever).
>
> The browser requests are all directed to www.google.com, but still all
> requests go through serverA, because it is the configured http proxy.
> And serverA, by virtue of its proxy functionality would normally forward
> these requests to www.google.com (or serve them from its cache of
> www.google.com items).
>
> Now in serverA, you set up some early URL filter which will rewrite (modify)
> all requests which you do not really want to go to www.google.com, and
> substitute the appropriate URL so that this item will be instead "proxied"
> to serverB instead of www.google.com.
> (In other words e.g., in all requests ending in ".gif", you change to
> hostname to "serverB").
> So for some requests, www.google.com delivers the content, while from some
> others it will be serverB.  But all responses eventually go back through the
> serverA proxy, which delivers them to the browser.

Actually, it would be fine to just rewrite the url to a location on my
local web server.  I scratched my head figuring out how to do this,
until I noticed that my RewriteRule ^/ig wasn't matching, but .*ig.*
was.  I figured that the rewrite module must handle proxied urls
differently, so I wrote a script to use as a RewriteMap that simply
copied standard input to a file, and to standard output again.
Reading the file, it turns out (is this documented somewhere?) that
the url comes to the RewriteRule in the form of
"proxy:http://www.google.com/ig"; which I can now rewrite to
http://localhost/ig.  So, problem solved.

> I believe the browser wouldn't know the difference, because for him all
> requests are to www.google.com (while using the proxy serverA), and that's
> where it thinks it gets the responses from.  I don't think that the browser
> "matches" the responses back with its requests, to check inside if they
> really come from the same place.
> Because if it did, then the whole proxy mechanism wouldn't work in the first
> place.

When behind a proxy, the browser sends request to the proxy in the
form of GET http://www.google.com/ig, rather than sending GET /ig to
www.google.com.  It has no idea if the proxy server did some tricky
things behind its back.

> Or maybe I'm totally wrong with this, but it seems at least plausible, no ?

Your idea is more complicated than I needed, but I think it should work too.

Thanks Andre, and everyone else; I've got it working.

> André
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>
>



-- 
Tavian Barnes

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux