Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-03-25 21:58:31 +0300
committerStan Hu <stanhu@gmail.com>2015-03-25 22:27:10 +0300
commit8173ef976f91088d17b28a1581ab6fd80949e462 (patch)
tree7b517b0480b253b059334544697632badc724650 /app/controllers
parent6199da0cb49d2e30071d2bbb08735ce2265c7aff (diff)
Set Application controller default URL options to ensure all url_for calls are consistent
Closes #1249
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index e284f31f7ee..2809f90c0d5 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -178,6 +178,18 @@ class ApplicationController < ActionController::Base
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
+ def default_url_options
+ if !Rails.env.test?
+ port = Gitlab.config.gitlab.port unless Gitlab.config.gitlab_on_standard_port?
+ { host: Gitlab.config.gitlab.host,
+ protocol: Gitlab.config.gitlab.protocol,
+ port: port,
+ script_name: Gitlab.config.gitlab.relative_url_root }
+ else
+ super
+ end
+ end
+
def default_headers
headers['X-Frame-Options'] = 'DENY'
headers['X-XSS-Protection'] = '1; mode=block'