From 8c1f314fbcf0551953560242c09d8bf942f44d35 Mon Sep 17 00:00:00 2001 From: Ricky Elrod Date: Mon, 18 Jul 2016 23:42:51 +0000 Subject: [PATCH] Try a fix for #5224 Signed-off-by: Ricky Elrod --- roles/people/files/cgit.conf | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/roles/people/files/cgit.conf b/roles/people/files/cgit.conf index 791d01bda2..2964654f7b 100644 --- a/roles/people/files/cgit.conf +++ b/roles/people/files/cgit.conf @@ -1,2 +1,39 @@ Alias /cgit-data /usr/share/cgit + +# This code is copied from the regular /git cloning code. Since our cgit +# https clones don't seem to support push, we should be able to get away with +# copying a very similar config as for /git. + +# Begin http git clone +# First, deny write access +RewriteCond %{QUERY_STRING} service=git-receive-pack [OR] +RewriteCond %{REQUEST_URI} /git-receive-pack$ +RewriteRule ^/cgit/ - [E=AUTHREQUIRED:yes] + + + Require not env AUTHREQUIRED + Require all granted + + Options -Indexes +ExecCGI + + +# Next up, determine which user owns this repo +SetEnvIf Request_URI ^/cgit/([a-zA-Z0-9]*)/.* GIT_PROJECT_ROOT=/home/fedora/$1/public_git +Header set X-GitProject "%{GIT_PROJECT_ROOT}e" + +# Let's serve objects and packs directly from apache, very performant! +AliasMatch ^/cgit/([a-zA-Z0-9]*)/public_git/([a-zA-Z0-9]*)\.git(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /home/fedora/$1/public_git/$2.git/$3 +AliasMatch ^/cgit/([a-zA-Z0-9]*)/public_git/([a-zA-Z0-9]*)\.git(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /home/fedora/$1/public_git/$2.git/$3 + +# And now for the magic, let's run the git cgi script +ScriptAliasMatch \ + "(?x)^/cgit/([a-zA-Z0-9]*)/public_git/(.*/(HEAD | \ + info/refs | \ + objects/(info/[^/]+ | \ + [0-9a-f]{2}/[0-9a-f]{38} | \ + pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ + git-(upload|receive)-pack))$" \ + /usr/libexec/git-core/git-http-backend/$2 +# End http git clone + ScriptAlias /cgit /var/www/cgi-bin/cgit