I was able to figure this out with some help from @Akiomi's answer:
In my routes.rb I added the following code at the beginning of the file:
match '(:anything)' => 'application#nothing', via: [:options]
Next, in my application controller, I added:
def nothing render text: '', content_type: 'text/plain' end
Along with the headers in config/application.rb :
config.action_dispatch.default_headers = { 'Access-Control-Allow-Origin' => '*', 'Access-Control-Request-Method' => 'GET, PATCH, PUT, POST, OPTIONS, DELETE', 'Access-Control-Allow-Headers:' => 'Origin, X-Requested-With, Content-Type, Accept' }
Yes, pay attention to the 'Access-Control-Allow-Headers:' => 'Origin, X-Requested-With, Content-Type, Accept' , which was not included in my initial question, this is one of the big problems.
Ben aubin
source share