summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-03-25 11:58:31 -0700
committerStan Hu <stanhu@gmail.com>2015-03-25 12:27:10 -0700
commit8173ef976f91088d17b28a1581ab6fd80949e462 (patch)
tree7b517b0480b253b059334544697632badc724650 /app
parent6199da0cb49d2e30071d2bbb08735ce2265c7aff (diff)
downloadgitlab-ce-8173ef976f91088d17b28a1581ab6fd80949e462.tar.gz
Set Application controller default URL options to ensure all url_for calls are consistent
Closes #1249
Diffstat (limited to 'app')
-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'