cyu / rack-cors

Rack Middleware for handling Cross-Origin Resource Sharing (CORS), which makes cross-origin AJAX possible.
MIT License
3.26k stars 263 forks source link

rack-cors does not support rails 4.2 #193

Closed KevinColemanInc closed 4 years ago

KevinColemanInc commented 4 years ago

Rails 4 uses rack 1.6:

https://github.com/rails/rails/blob/4-2-stable/Gemfile.lock#L26

rack-cores calls #unescaped that was introduced in rack 2.0.0

Suggested Fixes:

  1. Drop support for rails 4.2 by updating the docs.
  2. Support both
typeoneerror commented 4 years ago

@KevinColemanInc appears to be fixed in 1.0.6? The versioning here is a bit confusing since these are major breaking changes. Think there should be a 2.x, 3.x, etc releases instead of 1.0.4–1.0.6.

cyu commented 4 years ago

@KevinColemanInc version 1.0.6 should be compatible with Rails 4.2. I used unescape_path in v1.0.5 which is a Rack 2.0.0 interface, but in 1.0.6 I am using unescape which is available in Rack 1.6.0.

@typeoneerror I don't see this worthy of a major or minor version bump. The API hasn't really change. It's only breaking because I goofed up the versioning and dependency declaration. Right now, if you run bundle update on a project, it will also update rack if you're below 1.6.0 and other dependencies allow it. If other dependency don't allow an update to Rack 1.6.0, then Rack::Cors should fail to update as well.

Having said that, I just pushed out a version 1.1.0 that does require Rack 2.0.