Skip to content

Use Debug Mode in Rack CORS Middleware

Published: at 12:44 PM

rack-cors middleware comes with a handy debug option:

use Rack::Cors, debug: true do
  allow do
    (...)
  end
end

If this option is active, each response from the resource will contain an additional header with useful information when setting up CORS. For example:

X-Rack-CORS: preflight-miss; no-origin

X-Rack-CORS: preflight-miss; no-path