Sidekiq: Sidekiq Web :: Nginx issue

Created on 16 Sep 2016  路  9Comments  路  Source: mperham/sidekiq

Hi!

I've updated Sidekiq to the last version and now I got an error when accessing the web interface via Nginx.
When accessing directly via http://127.0.0.1:5000 it works but when I try via Nginx I got this error in Nginx logs (with a 502 bad gateway error) :

2016/09/16 14:11:35 [error] 7475#7475: *90 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /sidekiq/scheduled HTTP/1.1", upstream: "http://127.0.0.1:5000/sidekiq/scheduled", host: "back.local", referrer: "http://back.local/sidekiq/busy"

Thank you!

Most helpful comment

All 9 comments

We're hitting the same issue. it looks like sidekiq web is adding an additional rack.session cookie for each request. After enough requests the header section of the response gets too big for nginx and you get the above message.

Please show how you are initializing Sidekiq::Web. Are you doing anything more than this?

require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'

Our invocation looks very similar to that:

require 'sidekiq/pro/web'
...
APPNAME::Application.routes.draw do
...
  mount Sidekiq::Web => '/sidekiq'
...
end

I can also reproduce in 'myapp' in this repo.

  • Start the rails server bundle exec rails server
  • (N-many times) Run this command to see the count of rack.session cookies: curl -vvv -XGET http://localhost:3000/sidekiq/stats 2>&1 | grep 'rack\.session' | wc -l

You should see the number increase each curl invocation.

Reproducing the problem is 90% of the solution so that's hugely useful - thank you!

I've also run into this issue in production. Was able to work around it using this answer:

    proxy_buffer_size   128k;
    proxy_buffers   4 256k;
    proxy_busy_buffers_size   256k;

@Mavvie : thanks for the workaround :)

By the way there might be a bug with the trailing slash on the root page : even with the Nginx fix, I get an error without the trailing slash. If I add it manually it works.

/sidekiq => error
/sidekiq/ => works

Thank you so much, I had this bug for around 1 year 馃拑

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BeRMaNyA picture BeRMaNyA  路  3Comments

aglushkov picture aglushkov  路  3Comments

paul-ylz picture paul-ylz  路  4Comments

michaeldiscala picture michaeldiscala  路  4Comments

fatcatt316 picture fatcatt316  路  4Comments