Heroku, Rails 4, and Rack::Cors

前端 未结 6 2066
既然无缘
既然无缘 2020-12-13 20:20

I am trying to use Rack::Cors with my Rails 4 application so that I can do a JSON based API.

CORS is in my Gemfile like this:

gem \'rack-cors\', :req         


        
6条回答
  •  醉酒成梦
    2020-12-13 20:57

    It looks like the issue is being caused by my machine or the network I am on. I SSHed into a hosting environment I use and used the curl command above and it worked.

    Additional Note Here is something else that just happened that I thought I ought to add to this. My AJAX request was not to the https URL for my Heroku app, but Heroku was translating it be https. This was causing an additional cross-origin issue. Switching to use https for the AJAX request fixed this.

提交回复
热议问题