caddy: http 502 - caddy proxies to svn server

1. What version of Caddy are you using (caddy -version)?

0.10.10 I can reproduce the error with linux and windows builds.

2. What are you trying to do?

Using Caddy as a proxy (HTTP and HTTPS) to a apache httpd with subversion module enabled

3. What is your entire Caddyfile?

http://svn.myhome.net {
  log stdout
  errors stderr
  proxy / http://127.0.0.1:8088 {
  }
}

4. How did you run Caddy (give the full command and describe the execution environment)?

caddy --conf Caddyfile

5. Please paste any relevant HTTP request(s) here.

6. What did you expect to see?

No error while “svn up”

7. What did you see instead (give full error messages and/or log)?

In TortoiseSVN: Error GET request on Error /svn/test/!svn/ver/1/foo/bar.mp3 Error failed: 502 Bad Gateway

8. How can someone who is starting from scratch reproduce the bug as minimally as possible?

Install apache + svn in docker using this Dockerfile:

FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs/
RUN mv /usr/local/apache2/conf/httpd.conf /usr/local/apache2/conf/httpd.conf_default
RUN apt-get update && apt-get install -y \
    subversion \
    libapache2-mod-svn \
 && rm -rf /var/lib/apt/lists/*
RUN mkdir /opt/svn
RUN svnadmin create /opt/svn/public
RUN svnadmin create /opt/svn/media
RUN chown -R daemon:daemon /opt/svn

Building the docker container using

docker run  -dit \
            -v $(pwd)/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf \
            -v $(pwd)/conf/digest.passwd:/opt/svn/digest.passwd \
            -p 8088:8088 \
            --name apache_svn \
            apache_svn

Modify the httpd.conf

LoadModule dav_module           /usr/lib/apache2/modules/mod_dav.so
LoadModule dav_svn_module       /usr/lib/apache2/modules/mod_dav_svn.so
#SSLVerifyClient require

<Location /public>
  DAV svn
  SVNPath /opt/svn/public
  AuthType Digest
  AuthName "svn.myhost.net"
  AuthDigestDomain /public http://svn.myhost.net/public
  AuthDigestProvider file
  AuthUserFile /opt/svn/digest.passwd

  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </LimitExcept>
</Location>

Add a valid user to the /opt/svn/digest.passwd file

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

testing with caddy 0.11 it works well except for svn RENAME commands.

I used wireshare to detect the differences between “caddy proxy” way and the “direct” way. The http COPY command failed with 502 error. But after changig the “Destination” http header value it works well.

so I used the https://github.com/mholt/caddy/pull/2144 feature to rewrite the header value:

  proxy / http://127.0.0.1:8088 {
    header_upstream OriginalDestination {>Destination}
    header_upstream Destination "https://mydomainname.net(.*)" "http://127.0.0.1:8088/$1"
  }

👍