On Tue, Aug 23, 2011 at 11:29 AM, Joe Van Dyk <[email protected]> wrote: > On Tue, Aug 23, 2011 at 11:22 AM, Joe Van Dyk <[email protected]> wrote: >> On Mon, Aug 22, 2011 at 1:38 PM, Eric Wong <[email protected]> wrote: >>> Joe Van Dyk <[email protected]> wrote: >>>> Narrowed this down a little bit more. >>>> >>>> Nginx is receiving a HEAD request, unicorn is logging a GET. >>>> Somewhere along the chain, the http method is getting mangled. >>> >>> That's not good. I'm pretty sure all versions of nginx send HEAD >>> requests as-is to Unicorn, so something in your Rack middleware stack is >>> rewriting HEAD => GET. >>> >>> You can strace a Unicorn worker to confirm it receives a HEAD and not a >>> GET at the socket level. Do it on a server that's not receiving any >>> other traffic and use one worker process so you're always stracing the >>> correct worker process. >> >> I started a new Rails application at >> https://github.com/joevandyk/unicorn-head-requests >> >> When I send unicorn a HEAD request, it logs it as a GET. This shows >> up in the unicorn log: >> 127.0.0.1 - - [23/Aug/2011 11:15:38] "GET / HTTP/1.1" 200 - 0.0231 >> >> But this is what shows up in Rails: >> Started HEAD "/" for 127.0.0.1 at 2011-08-23 11:15:58 -0700 >> Processing by WelcomeController#index as > > I tracked down the exception to a bug in a Rack middleware. But -- > unicorn should be logging HEAD requests as a HEAD request (and not a > GET), right?
Ok -- this officially isn't a unicorn bug. :) Something in Rails (or something Rails uses). With a HEAD request, env["REQUEST_METHOD"] inside Rack::Lint, is 'GET'. Only happens with Rails (tried it in 3.0 and 3.1). Doesn't happen with Sinatra. Joe _______________________________________________ Unicorn mailing list - [email protected] http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
