Thursday, January 30, 2014

redmine, Bad Gateway error, file upload max size

Redmine and other ruby on rails apps can have issues with large file uploads or file uploads with a slow internet connection.

In redmine you may get the dreaded 502 Bad Gateway error showing up in the user interface.

Here are the pieces: Apache, unicorn, rails, and redmine.

Short version is you need to set the timeout config variable to something higher... like perhaps 120 seconds.  It's not the best solution, but it will let you upload files.

Here is a blog post which describes unicorn.rb configuration.

There's a setting in the redmine administration section of the tool to increase the maximum file size if you need to do that.

You may find apache error log entries like this:
[Thu Jan 30 11:11:08 2014] [error] (103)Software caused connection abort: proxy: pass request body failed to 127.0.0.1:7000 (localhost)
[Thu Jan 30 11:11:08 2014] [error] proxy: pass request body failed to 127.0.0.1:7000 (localhost) from 1x.1x.1x.1x ()

Also, you may also need to change your web server configuration to allow larger post sizes.  For example, to set the limit at 100MB might be something like this for Apache httpd 2:
LimitRequestBody 104857600