升级到Rails 5.2的所有COR之后,请求失败

时间:2019-06-24 21:52:10

标签: ruby-on-rails

我已经将我的应用程序从Rails 4.2.11.1升级到了Rails 5.2.3。现在,我假设所有与COR相关的选项都失败了。我已经在application.rb中注释掉了COR代码,但仍然失败。

注释代码

    # Open CORS for development
    unless Rails.env.production?
      config.middleware.insert_before 0, Rack::Cors, debug: true, logger: (-> { Rails.logger }) do
        allow do
          origins '*'

          resource '/cors',
                   headers: :any,
                   methods: [:post],
                   credentials: false,
                   max_age: 600

          resource '*',
                   headers: :any,
                   methods: [:get, :post, :delete, :put, :patch, :options, :head],
                   expose: ['access-token', 'expiry', 'token-type', 'uid', 'client', 'Total', 'Per-Page', 'Link'],
                   max_age: 600
        end
      end
    end
  end

0 个答案:

没有答案