fixed 修改跨域方式
This commit is contained in:
parent
4e51ad0cf3
commit
b7a93137db
|
@ -1,5 +1,4 @@
|
|||
require_relative 'boot'
|
||||
require_relative '../lib/middleware/silence_log.rb'
|
||||
|
||||
require 'rails/all'
|
||||
|
||||
|
@ -7,7 +6,7 @@ require 'rails/all'
|
|||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
module Educoderplus
|
||||
module Gitlink
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 5.2
|
||||
|
@ -18,11 +17,11 @@ module Educoderplus
|
|||
# the framework and any gems in your application.
|
||||
#
|
||||
#
|
||||
# config.educoder = config_for(:configuration)
|
||||
# config.gitlink = config_for(:configuration)
|
||||
|
||||
config.assets.precompile += %w( promotion.js promotion.css )
|
||||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
|
||||
config.active_record.default_timezone = :local
|
||||
config.active_record.default_timezone = :utc
|
||||
config.time_zone = 'Beijing'
|
||||
|
||||
# I18n
|
||||
|
@ -32,16 +31,18 @@ module Educoderplus
|
|||
# job
|
||||
config.active_job.queue_adapter = :sidekiq
|
||||
|
||||
# disable actioncable development nend true
|
||||
# config.action_cable.disable_request_forgery_protection = true
|
||||
|
||||
config.middleware.use OmniAuth::Builder do
|
||||
provider :cas, url: 'https://urp.tfswufe.edu.cn/cas'
|
||||
end
|
||||
|
||||
config.middleware.insert_before 0, Rack::Cors do
|
||||
allow do
|
||||
# origins '*'
|
||||
origins /http:\/\/localhost(:\d+)?\z/, /^(http|https):\/\/(.*(gitlink.org.cn))$/
|
||||
origins '*'
|
||||
# location of your api
|
||||
resource '/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put], credentials: true
|
||||
resource '/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put, :patch]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue