1 = Frequently Asked Questions about Unicorn
3 === Why are my redirects going to "http" URLs when my site uses https?
5 If your site is entirely behind https, then Rack applications that use
6 "rack.url_scheme" can set the following in the Unicorn config file:
8 HttpRequest::DEFAULTS["rack.url_scheme"] = "https"
10 For frameworks that do not use "rack.url_scheme", you can also
11 try setting one or both of the following:
13 HttpRequest::DEFAULTS["HTTPS"] = "on"
14 HttpRequest::DEFAULTS["HTTP_X_FORWARDED_PROTO"] = "https"
16 Otherwise, you can configure your proxy (nginx) to send the
17 "X-Forwarded-Proto: https" header only for parts of the site that use
18 https. For nginx, you can do it with the following line in appropriate
19 "location" blocks of your nginx config file:
21 proxy_set_header X-Forwarded-Proto https;
23 === Why are log messages from Unicorn are unformatted when using Rails?
25 Current versions of Rails unfortunately overrides the default Logger
28 You can undo this behavior with the default logger in your Unicorn
31 Configurator::DEFAULTS[:logger].formatter = Logger::Formatter.new
33 Of course you can specify an entirely different logger as well
34 with the "logger" directive described by Unicorn::Configurator.
36 === Why am I getting "connection refused"/502 errors under high load?
38 Short answer: your application cannot keep up.
40 You can increase the size of the :backlog parameter if your kernel
41 supports a larger listen() queue, but keep in mind having a large listen
42 queue makes failover to a different machine more difficult.
44 See the TUNING and Unicorn::Configurator documents for more information
45 on :backlog-related topics.