summaryrefslogtreecommitdiff
path: root/lib/gitlab/backend
diff options
context:
space:
mode:
authoramouhzi <hassan.amouhzi@gmail.com>2013-07-30 16:48:00 +0200
committerHassan Amouhzi <github@anezi.net>2013-08-15 21:25:09 +0200
commit39d8a64d255a80df1ed3194f88ac56486b027870 (patch)
tree17e1ce8ebde53f88aee03c473dd4493e815100ac /lib/gitlab/backend
parent55582047413c639a4843f52f9869fafc01bf6522 (diff)
downloadgitlab-ce-39d8a64d255a80df1ed3194f88ac56486b027870.tar.gz
Fixes grack authentification under relative_url_root
Ref: https://github.com/gitlabhq/gitlabhq/commit/e6159b8725f99af78f446f8d33fa0e52b7780430 Ref: https://github.com/gitlabhq/gitlabhq/pull/3204 Ref: https://github.com/gitlabhq/gitlabhq/issues/1228 Add Rails' variable in application.rb to support relative url This variable is used by assets compilation and other modules. Note that user needs to change application.rb too Restrict session cookie to the relative path if set. Ref: https://github.com/gitlabhq/gitlabhq/commit/2c2f1e31856a4decdae469974f5bea8245316f7e Fix Update attachment_uploader.rb bug with relative URL See: https://github.com/gitlabhq/gitlabhq/commit/161afda3fa4fca58f396e9c3acbd72bc14490ace Fix Wall relative bug with attachement files (javascript)
Diffstat (limited to 'lib/gitlab/backend')
-rw-r--r--lib/gitlab/backend/grack_auth.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb
index a4f98ecd350..ddf370fbab8 100644
--- a/lib/gitlab/backend/grack_auth.rb
+++ b/lib/gitlab/backend/grack_auth.rb
@@ -15,7 +15,15 @@ module Grack
@auth = Request.new(env)
# Need this patch due to the rails mount
- @env['PATH_INFO'] = @request.path
+
+ # Need this if under RELATIVE_URL_ROOT
+ unless Gitlab.config.gitlab.relative_url_root.empty?
+ # If website is mounted using relative_url_root need to remove it first
+ @env['PATH_INFO'] = @request.path.sub(Gitlab.config.gitlab.relative_url_root,'')
+ else
+ @env['PATH_INFO'] = @request.path
+ end
+
@env['SCRIPT_NAME'] = ""
auth!