I have a react app running on localhost:3001 and a rails 6 api backend on localhost:3000
I keep getting cors errors when I post from react to rails. The rails app has Rack Cors.
I've tried adding this to cors.rb in the initializers folder.
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: :any
end
end
It didn't work, I also tried to add it to application.rb and config.ru. Noting has worked, and I am confused.