Last active
August 29, 2015 14:04
-
-
Save knowuh/30c11efd0d17c925bbcf to your computer and use it in GitHub Desktop.
Extra slashes in CORS requests causes rack/cors errors on Heroku as of 07/25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Last night CORS requests stopped working for us on Heroku. We are using rack-cors (0.2.8) middleware. | |
It rurns out our request paths didn't match our rackup configuration. | |
The real question might be: why were these requests returning correct HTTP headers in the past? | |
One hypothesis is that some other processes was cleaning up requests with redundant slashes. | |
The configuration: | |
#… | |
require 'rack/cors' | |
use Rack::Cors do | |
allow do | |
origins '*' | |
resource '/shutterbug/*', :headers => :any, :methods => :any | |
end | |
end | |
#… | |
# Requests that USED to work, but stopped working (note the dubble slash // ): | |
curl -H "Origin: http://example.com" --verbose \ | |
http://shutterbug.herokuapp.com//shutterbug/make_snapshot | |
# Requests that DO work now for us: | |
curl -H "Origin: http://example.com" --verbose \ | |
http://shutterbug.herokuapp.com/shutterbug/make_snapshot | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment