I am using Subversion Edge 5.2.2 behind a reverse proxy server. All services ViewVC, console and Subversion server look fine / working at first glance.
The Subversion server however does not work for specific Subversion commands for example svn cp
returns
svn: E175002: Unexpected HTTP status 502 'Bad Gateway' on '/svn/petclinic/!svn/rvr/16/trunk'
If I bypass the reverse proxy and access Subversion Edge directly those commands do work.
The Subversion Edge documentation does not have any information on reverse proxy configuration so it seems this "enterprise" product does not support this typical "enterprise" deployment pattern.
Can Subversion Edge work be configured to work correctly behind a reverse proxy? How should it be configured?
This error occurs because nginx passes the Destination
header to the subversion server without modification. If you use https on the nginx server but only http on the subversion server, subversion will not be able to execute a COPY or MOVE method because the Destination
header contains a https://
value.
You can confirm this by checking nginx's access.log
; if you see a COPY or MOVE request with a 502
response, followed by a DELETE, then this is likely the issue, e.g.:
… COPY /foo/!svn/rvr/111/trunk HTTP/1.1" 502 …
… DELETE /foo/!svn/txn/111-6v HTTP/1.1" 204 …
You can solve this by rewriting the Destination header on either server:
RequestHeader edit Destination ^https http early
set $dest $http_destination;
if ($http_destination ~ "^https://(.+)$") {
set $dest http://$1;
}
proxy_set_header Destination $dest;