I use very often ProxyPass to do things like

  ProxyPass  /services/     http://service-machine/services/

Put sometimes there are cases when I have this Location /services/
which I want to be passed forward, but I have also Location
/services/images/ - which should be kept local!!  This can be
done with mod_rewrite, but it's not very nice to configure
(and mod_rewrite and mod_proxy are in wrong in standard configuration
anyway).

So. I made very little patch for mod_proxy.c.  Now I can make
configuration like this.

  ProxyPass /services/images/     !
  ProxyPass /services/            http://service-machine/services/

This means that /services/images/* are kept local machine and
all other stuff from Location /services/ are passed forward to
service-machine.

I have seen this patch very usefull so far.


A small patch to src/modules/proxy/mod_proxy.c
function "proxy_trans"   (this is for apache version 1.3.23 (latest)).
(just two lines of extra code)

    pihl

----------- patch follows -------------------

--- mod_proxy.c.orig    Tue Jan 29 16:09:34 2002
+++ mod_proxy.c Tue Jan 29 16:11:32 2002
@@ -196,6 +196,8 @@
         len = alias_match(r->uri, ent[i].fake);

        if (len > 0) {
+           if((ent[i].real[0] == '!') && (ent[i].real[1] == 0))
+               return DECLINED;
            r->filename = ap_pstrcat(r->pool, "proxy:", ent[i].real,
                                  r->uri + len, NULL);
            r->handler = "proxy-server";

----------- patch ends -----------------------







Reply via email to