Still breathing

Still around. At some point I really need to spend the time to write something worth posting here. Most of my notes end up in a private ticketing system with the goal of cleaning them up and posting publicly, but it’s not working out very well.

One thing I will be working on in the coming year is migrating many older/smaller projects over to GitHub. While SVN is still a very useful tool, GitHub is an amazing platform for collaborative development. I’ve been using it quite a bit in the last few months and I’ve come to really appreciate its usefulness. Where I once saw “forking” a project as harmful to a project, I’ve come to understand that Git doesn’t encourage a different model of thinking or coding, it just opens up some options that were not there before. The concern I had about developers taking the code, going off into a cave and not committing back is probably best handled by policy/development culture than it is by the version control system.

Server sent unexpected return value (502 Bad Gateway) in response to COPY

This was an annoying issue. I initially blamed it on an Apache update and wasted a lot of time going in that direction. When I finally gave up and used Google, I got somewhere.

Thankfully, I wasn’t the only person to run into this and there are at least three different solutions to the problem. Take your pick.

It was explained rather succinctly here:

because nginx pass to backend https:// url in Destination header.
but http:// and https:// urls can not be mixed in COPY request.

In short, the front end speaks https to the client, but it speaks http (non-ssl) to the back end. The header is not changed to reflect this and the COPY command fails.

  1. Rewrite the Destination header via nginx’s rewrite feature:

    set $fixed_destination $http_destination;
    if ( $http_destination ~* ^https(.*)$ )
    {
    set $fixed_destination http$1;
    }

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Destination $fixed_destination;
    proxy_pass http://subversion_hosts;

  2. Have Apache also use SSL (I was using this approach until just recently)
  3. Use mod_headers with Apache.