add cors
This commit is contained in:
parent
98c9701a6f
commit
10cf40e358
1
Gemfile
1
Gemfile
|
@ -43,6 +43,7 @@ group :development do
|
|||
gem 'guard-rails'
|
||||
gem 'guard-rspec', require: false
|
||||
gem 'guard-bundler', require: false
|
||||
gem 'rack-cors', :require => 'rack/cors'
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
|
|
@ -170,6 +170,7 @@ GEM
|
|||
quiet_assets (1.1.0)
|
||||
railties (>= 3.1, < 5.0)
|
||||
rack (1.5.2)
|
||||
rack-cors (0.3.1)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (4.1.8)
|
||||
|
@ -317,6 +318,7 @@ DEPENDENCIES
|
|||
pry-nav
|
||||
pry-rails
|
||||
quiet_assets
|
||||
rack-cors
|
||||
rails (= 4.1.8)
|
||||
redcarpet
|
||||
rest-client
|
||||
|
|
|
@ -51,4 +51,4 @@
|
|||
.item.item-text-wrap
|
||||
p
|
||||
| WBlog 是我亲手一行行写出来的, 开源可复用, 采用协议 MIT, 你可以在 Github 上找到它:
|
||||
a href='https://github.com/windy/wblog' target='_blank' https://github.com/windy/wblog
|
||||
a href='https://github.com/windy/wblog' target='_blank' location='yes' https://github.com/windy/wblog
|
||||
|
|
|
@ -24,6 +24,13 @@ WBlog::Application.configure do
|
|||
# number of complex assets.
|
||||
config.assets.debug = true
|
||||
|
||||
config.middleware.insert_before 0, "Rack::Cors" do
|
||||
allow do
|
||||
origins '*'
|
||||
resource '*', :headers => :any, :methods => [:get, :post, :options]
|
||||
end
|
||||
end
|
||||
|
||||
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
||||
|
||||
config.action_mailer.smtp_settings = {
|
||||
|
|
Loading…
Reference in New Issue