WebDAV behind a reverse proxy

smember picture smember · Jul 10, 2009 · Viewed 18.7k times · Source

I have 2 servers. One Reverse proxy on the web and one on a private link serving WebDAV.

Booth servers are apache httpd v2.

On the proxy I have:

    ProxyRequests Off

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass           /repo/ http : //share.local/repo/
    ProxyPassReverse    /repo/ http : //share.local/repo/

On the dav server I have:

<Location /repo/>
    DAV on
    Order allow,deny
    allow from all
</Location>

The reverse proxy is accessed via https and the private server is accessed via http. And there lies the problem!

Read only commands work fine. But when I want to move something I get 502 Bad gateway. The reason for this is the reverse proxy not rewriting the url's inside the extended dav request.

The source URL is inside the header and is correctly transformed to http://share.local/file1. The destination URL is inside some xml fragment I do not understand and stays https://example.com/file1 :(

Is there a standard way to let the apache correctly transform the request?

Thanks for your effort.

Answer

smember picture smember · Jul 10, 2009

Hmm, found the answer. Always the same :)

I added the next line to my 'private server' config file:

LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so

RequestHeader edit Destination ^https http early

(e.g. of config location '/etc/httpd/conf.d/DefaultRequestHeader.conf')

and it worked. I don't know if this has drawbacks. I'll see.