www-modproxy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Pihl <jukka.p...@entirem.com>
Subject ProxyPass. small and usefull patch.
Date Fri, 09 Nov 2001 14:32:38 GMT


We have used quite much apache as frontend machine
where mod_proxy + 'ProxyPass' has been very important feature.

There is one thing that is too difficult with ProxyPass.

I have situation.

Where I want someting like

	/ 	         ==>  http://other-host/
	/some-images/    ==>  keep local.

I want to say to mod_proxy that proxypass everything EXCEPT that(and that)
to given host.

My medicine is to add some lines of code to every new version of apache.
(to mod_proxy.c)

Now I can write somehing like:

	ProxyPass  /some-images/   ! 
	ProxyPass  / 	           http://other-host/

Where  '!' means that given uri is not proxied but kept local.
It makes much simpler to make some proxy-rules.
Same can be done with mod_rewrite.... but that is more complicated.




HOW:

I just add some code to  mod_proxy.c - function 

	static int proxy_trans(request_rec *r)


....next patch is to Apache 2.0 - httpd-2_0_27/modules/proxy/

     Jukka Pihl
     jukka.pihl at entirem.com

--------------------  PATCH --------------------
--- mod_proxy.c.orig	Fri Nov  9 16:11:14 2001
+++ mod_proxy.c	Fri Nov  9 16:16:04 2001
@@ -188,6 +188,9 @@
         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 = apr_pstrcat(r->pool, "proxy:", ent[i].real,
                                  (r->uri + len - 1), NULL);
            r->handler = "proxy-server";

Mime
View raw message