Hello.
Attached patch allows for MOVE/COPY requests when dav server is behind reverse 
proxy. It simply translates the Destination header.

diff -ur httpd-2.2.9-orig/modules/proxy/mod_proxy.c httpd-2.2.9-dav-reverse-proxy/modules/proxy/mod_proxy.c
--- httpd-2.2.9-orig/modules/proxy/mod_proxy.c	2008-05-28 23:11:24.000000000 +0200
+++ httpd-2.2.9-dav-reverse-proxy/modules/proxy/mod_proxy.c	2008-09-18 18:16:18.000000000 +0200
@@ -494,6 +494,55 @@
     }
     return ret;
 }
+
+static void proxy_trans_destination(request_rec *r)
+{
+	char *dest = apr_table_get(r->headers_in, "Destination");
+	if (!dest)
+		return;
+
+
+    apr_uri_t dest_uri;
+
+    if (apr_uri_parse(r->pool, dest, &dest_uri) != APR_SUCCESS) {
+        return;
+    }
+
+    void *sconf = r->server->module_config;
+    proxy_server_conf *conf =
+    (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module);
+    int i, len;
+    proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config,
+                                                 &proxy_module);
+
+    const char *fake;
+    const char *real;
+    struct proxy_alias *ent = (struct proxy_alias *) conf->aliases->elts;
+
+    for (i = 0; i < conf->aliases->nelts; i++) {
+        const char *use_uri = dest_uri.path;
+        if ((dconf->interpolate_env == 1)
+            && (ent[i].flags & PROXYPASS_INTERPOLATE)) {
+            fake = proxy_interpolate(r, ent[i].fake);
+            real = proxy_interpolate(r, ent[i].real);
+        }
+        else {
+            fake = ent[i].fake;
+            real = ent[i].real;
+        }
+
+        if (!ent[i].regex) {
+        	len = alias_match(use_uri, fake);
+			if (0 == len)
+				continue;
+
+        	use_uri = apr_pstrcat(r->pool, real, use_uri + len, NULL);
+        	apr_table_set(r->headers_in, "Destination", use_uri);
+        	return;
+        }
+    }
+}
+
 static int proxy_trans(request_rec *r)
 {
     void *sconf = r->server->module_config;
@@ -510,6 +559,8 @@
     char *found = NULL;
     int mismatch = 0;
 
+    proxy_trans_destination(r);
+
     if (r->proxyreq) {
         /* someone has already set up the proxy, it was possibly ourselves
          * in proxy_detect

Reply via email to