Performance: CORS configuration
MEDIUM IMPACT
CORS configuration affects the browser's ability to load resources from different origins, impacting page load speed and interaction readiness.
Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins 'https://trusted.example.com' resource '/api/*', headers: :any, methods: [:get, :post, :options] end end
Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins '*' resource '*', headers: :any, methods: [:get, :post, :options] end end
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Wildcard origins with broad resource access | Minimal | 0 | Low but delayed by network | [X] Bad |
| Restricted origins and resource paths | Minimal | 0 | Low and fast | [OK] Good |