diff options
author | Lauren Perry <lauren.perry@codethink.co.uk> | 2015-10-28 16:48:51 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2016-01-25 18:25:11 +0000 |
commit | 4c1a02ebe6e5a65b6a1bf79e3320b42f33222f3b (patch) | |
tree | c16a35310d10bfea1817bc3990ed2e6a675144c0 | |
parent | d83ffbf8aa6fa7cb3a8c50b03b77d0c09a88ed04 (diff) | |
download | trove-setup-4c1a02ebe6e5a65b6a1bf79e3320b42f33222f3b.tar.gz |
Redirect cgi-bin/cgit.cgi/ from urls, replace it with cgit/
This is much less typing and gives us neater URLs!
The paths /baserock and /delta are also now specially redirected to
/cgit/baserock and /cgit/delta, for the benefit of the extra-lazy.
Change-Id: I9cda805c0a6134fb91595bbf8f3e74668d745327
-rw-r--r-- | ansible/roles/trove-setup/templates/lighttpd/git-httpd.conf | 14 | ||||
-rw-r--r-- | http-assets/index.html | 2 | ||||
-rw-r--r-- | share/etc/cgitrc | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/ansible/roles/trove-setup/templates/lighttpd/git-httpd.conf b/ansible/roles/trove-setup/templates/lighttpd/git-httpd.conf index 8b4a22e..f2d61c9 100644 --- a/ansible/roles/trove-setup/templates/lighttpd/git-httpd.conf +++ b/ansible/roles/trove-setup/templates/lighttpd/git-httpd.conf @@ -10,6 +10,7 @@ server.modules = ( "mod_alias", "mod_compress", "mod_redirect", + "mod_rewrite", "mod_cgi", "mod_auth", "mod_setenv", @@ -61,6 +62,19 @@ $HTTP["url"] =~ "^/git/.*$" { ) } +# Avoid needlessly long cgit URLs. This must correspond with the +# 'virtual-root' setting in /etc/cgitrc. +url.rewrite-if-not-file = ( + "^/cgit/(.*)$" => "/cgi-bin/cgit.cgi/$1", +) + +# Allow /baserock and /delta, but redirect them to the proper /cgit/ path. +# Troves can contain arbitrary project names, so we can't do this for all +# projects, we just special-case the ones for git.baserock.org. +$HTTP["url"] =~ "^/(baserock|delta)(/.*)?$" { + url.redirect = ( "^/(.*)" => "/cgit/$1" ) +} + $HTTP["scheme"] == "https" { include "git-auth.conf" diff --git a/http-assets/index.html b/http-assets/index.html index 0a8c3f9..18069ec 100644 --- a/http-assets/index.html +++ b/http-assets/index.html @@ -1,5 +1,5 @@ <html><head> -<meta http-equiv="refresh" content="0; /cgi-bin/cgit.cgi"> +<meta http-equiv="refresh" content="0; /cgit/"> </head> <body> </body> diff --git a/share/etc/cgitrc b/share/etc/cgitrc index 28540dd..83daf94 100644 --- a/share/etc/cgitrc +++ b/share/etc/cgitrc @@ -24,3 +24,5 @@ mimetype.png=image/png mimetype.svg=image/svg+xml scan-path=/home/git/repos/ + +virtual-root=/cgit/ |