SVN/nginx - bad request

Issue #622 resolved
idbill_pugetworks
created an issue

We are having sporadic problems with svn-manager going thru our nginx proxy.

This is how I can duplicate the issue:

~$ svn copy https://mydomain.com/scm/svn/zcrowd/trunk https://mydomain.com/scm/svn/zcrowd/tags/0.9 -m 'Version 0.9'

svn: COPY of '/scm/svn/zcrowd/!svn/bc/950trunk': 400 Bad Request (https://mydomain.com)

Turning error_logging for nginx on to info outputs:

2014/08/26 14:39:09 [info] 12011#0: 92089 client 50.56.31.221 closed keepalive connection 2014/08/26 14:39:11 [info] 12008#0: 92077 client 50.56.31.221 closed keepalive connection 2014/08/26 14:39:11 [info] 12011#0: *92119 client 50.56.31.221 closed keepalive connection

I've tried setting an upstream and the following: proxy_http_version 1.1; proxy_set_header Connection "";

and proxy_http_version 1.0; proxy_set_header Connection "Keep-Alive";

and passed all request headers... proxy_pass_request_headers on;

and many other things with no change.

I'm at a loss as to where this problem is occurring... any suggestions would be helpful.

Bill

Comments (7)

  1. Sebastian Sdorra repo owner

    Could you please try to uncomment the following line in conf/server-config.xml:

    <Set name="forwarded">true</Set>
    

    And use the following configuration for your nginx:

    location /scm {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://localhost:8080;
    }
    
  2. idbill_pugetworks reporter

    OMG! It worked!

    FYI, beyond the server-config.xml setting change the only thing changed was the X-Forwarded-For was $remote_addr to $proxy_add_x_forwarded_for.

    My nginx setting now looks like: (and is working)

    location /scm {
        proxy_http_version 1.1;
        proxy_set_header Connection "";
    
        proxy_set_header        X-Real-IP          $remote_addr;
        #proxy_set_header        X-Forwarded-For    $remote_addr;
        proxy_set_header        X-Forwarded-For    $proxy_add_x_forwarded_for;
        # Tell proxied hosts to return with https
        proxy_set_header        X-Forwarded-Proto  $scheme;
        proxy_pass              http://scm;
    
        proxy_connect_timeout   5;
        proxy_intercept_errors  on;
        proxy_buffering         off;
    }
    

    Thank you, Bill

  3. Log in to comment