You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During testing, discovered that Unicorn would time out (15s timeout) when presented with a lot of CORS requests using this gem. Calling with jQuery from a different machine on the local network on a local server, when doing a loop of even 10 async requests, Unicorn would stall, then restart the workers, and receive 10 OPTIONS and 10 GET requests. When calling manually at a lower rate, everything is fine.
At the same time, the app can handle thousands of non-CORS requests via curl without a hitch. Any ideas what can be going wrong? How high of a load can this middleware handle? I've implemented it with only the steps described in the readme (without explicit routes for OPTIONS, it works) by adding this to application.rb:
config.middleware.insert_before 0, "Rack::Cors", :debug => true, :logger => (-> { Rails.logger }) do
allow do
origins 'http://localhost:3000'
resource '*',
:headers => :any,
:methods => [:get, :post, :delete, :put, :options],
:max_age => 0,
:credentials => true
end
end
UPDATE:
Unicorn actually has trouble responding even to one request. Often it would take a few seconds until anything is even seen in the log, but sometimes it would even exceed 15 seconds. Disabling concurrency didn't solve the problem.
With Puma, everything is fine and snappy so far. I will actually use Puma in production so it seems fine for me, but leaving this here in case someone runs into problems with Rack::Cors and Unicorn.
The text was updated successfully, but these errors were encountered:
During testing, discovered that Unicorn would time out (15s timeout) when presented with a lot of CORS requests using this gem. Calling with jQuery from a different machine on the local network on a local server, when doing a loop of even 10 async requests, Unicorn would stall, then restart the workers, and receive 10 OPTIONS and 10 GET requests. When calling manually at a lower rate, everything is fine.
At the same time, the app can handle thousands of non-CORS requests via curl without a hitch. Any ideas what can be going wrong? How high of a load can this middleware handle? I've implemented it with only the steps described in the readme (without explicit routes for
OPTIONS
, it works) by adding this toapplication.rb
:The request call looks like this:
Has anyone had a similar problem?
UPDATE:
Unicorn actually has trouble responding even to one request. Often it would take a few seconds until anything is even seen in the log, but sometimes it would even exceed 15 seconds. Disabling concurrency didn't solve the problem.
With Puma, everything is fine and snappy so far. I will actually use Puma in production so it seems fine for me, but leaving this here in case someone runs into problems with Rack::Cors and Unicorn.
The text was updated successfully, but these errors were encountered: