fetch patch request is not allowed

后端 未结 3 1337
萌比男神i
萌比男神i 2020-12-14 06:26

I have two apps one is a react front end and the second one is the rails-api app.

I have been happily using isomorphic-fetch till I needed to send PATCH method to th

3条回答
  •  醉话见心
    2020-12-14 06:59

    I had a very similar problem with reactJS front end and rails API using Rack::Cors, and adding patch to the list of allowed methods solved the problem for me.

    config.middleware.insert_before 0, Rack::Cors do
      allow do
        origins '*'
        resource '*', headers: :any, methods: [:get, :post, :patch, :options]
      end
    end
    

提交回复
热议问题