Nginx reverse proxy corrupting filenames
Gustavo Chaves <[email protected]>
| Newsgroups | gmane.comp.version-control.subversion.user |
|---|---|
| Message-ID | <CABrYJ5AD2okyrhMvjC9hJjEnWmjyaPWzsjguYfb7ymcAk0Qe7w@mail.gmail.com> |
I have a Subversion vesion 1.14.1 running behind a reverse proxy
implemented by nginx version 1.18.0 on a Ubuntu 22.04 server.
I'm having problems renaming files in it. I came up with the following
procedure to reproduce the problem:
> $ export LANG=C.UTF-8
> $ export LANGUAGE=en
> $ REPO=https://svn.domain.mine/repo
>
> $ svn co $REPO/trunk repo
> Checked out revision 19.
>
> $ cd repo
>
> $ echo doit >'plano de acao.txt'
>
> $ svn add 'plano de acao.txt'
> A plano de acao.txt
>
> $ svn commit -m'add file'
> Adding plano de acao.txt
> Transmitting file data .done
> Committing transaction...
> Committed revision 20.
>
> $ ls -lA
> total 8
> drwxrwxr-x 4 gustavo gustavo 4096 Jun 20 13:39 .svn
> -rw-rw-r-- 1 gustavo gustavo 5 Jun 20 13:40 'plano de acao.txt'
>
> $ svn mv 'plano de acao.txt' 'action plan.txt'
> A action plan.txt
> D plano de acao.txt
>
> $ svn commit -m'rename file'
> Adding action plan.txt
> Deleting plano de acao.txt
> Committing transaction...
> Committed revision 21.
>
> $ ls -lA
> total 8
> drwxrwxr-x 4 gustavo gustavo 4096 Jun 20 13:39 .svn
> -rw-rw-r-- 1 gustavo gustavo 5 Jun 20 13:40 'action plan.txt'
>
> $ svn up
> Updating '.':
> svn: E175009: The XML response contains invalid XML
> svn: E130003: Malformed XML: no element found at line 10
>
> $ cd ..
>
> $ rm -rf repo
>
> $ svn co $REPO/trunk repo
> A repo/action%20plan.txt
> Checked out revision 21.
>
> $ cd repo
>
> $ ls -lA
> total 8
> drwxrwxr-x 4 gustavo gustavo 4096 Jun 20 13:42 .svn
> -rw-rw-r-- 1 gustavo gustavo 5 Jun 20 13:42 action%20plan.txt
>
> $ svn up
> Updating '.':
> At revision 21.
Note the error message in the first "svn up" and also that the space
in the filename is checked out as "%20".
I can reproduce this problem only when I access the repository via an
URL that goes through the nginx reverse proxy. If I try via an URL
that goes directly to Apache httpd or locally (file://) the problem
does not happen.
This is the Nginx's server configuration I'm using for the proxy:
> server {
> listen 443 ssl;
> server_name svn.domain.mine;
>
> client_body_timeout 3600s;
> client_max_body_size 10m;
> keepalive_timeout 3600s;
> send_timeout 3600s;
>
> location / {
> proxy_pass http://localhost:3691;
> proxy_set_header X-Forwarded-For $remote_addr;
> proxy_set_header Host $host;
> proxy_buffering off;
> proxy_request_buffering off;
>
> # See https://sigterm.sh/2012/10/09/nginx-apache-2-and-subversion-502-bad-gateway-error/
> set $fixed_destination $http_destination;
> if ( $http_destination ~* ^https(.*)$ )
> {
> set $fixed_destination http$1;
> }
> proxy_set_header Destination $fixed_destination;
> }
> }
I wasn't able to find any mention of a similar problem via Google or
in Subversion's Jira.
Can you help me figure this out, please?
--
Gustavo