summaryrefslogtreecommitdiff
path: root/config/application.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-05 10:29:45 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-12-05 10:29:45 +0200
commit6edb4c0634740e4231e5939b13fd696b6823b3de (patch)
tree1d696efc17e8ca2fd02194150ef77cef61b24011 /config/application.rb
parent23d180f5f1905eb8d714daaf2d097767ff355817 (diff)
downloadgitlab-ce-6edb4c0634740e4231e5939b13fd696b6823b3de.tar.gz
Allow Cross-origin resource sharing for GitLab API
It will allow to write web applications on other domains to interact with GitLab instances Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'config/application.rb')
-rw-r--r--config/application.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb
index c46ff289cf8..d160e181ec3 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -79,5 +79,13 @@ module Gitlab
# config.relative_url_root = "/gitlab"
config.middleware.use Rack::Attack
+
+ # Allow access to GitLab API from other domains
+ config.middleware.use Rack::Cors do
+ allow do
+ origins '*'
+ resource '/api/*', headers: :any, methods: [:get, :post, :options, :put]
+ end
+ end
end
end