proxies-redirects: Add rewrite for cgit on src.fp.o (#7736)

This commit is contained in:
Mikolaj Izdebski 2019-04-25 05:41:22 +02:00
parent 93d0eeaf54
commit dde66ebd39
2 changed files with 28 additions and 0 deletions

View file

@ -17,6 +17,15 @@
- role: packages3/bugz.fp.o
website: bugz.fedoraproject.org
# A special rewrite for cgit
- role: httpd/redirect
shortname: cgit
website: src.fedoraproject.org
# Staging-only for now, due to F30 final freeze
# XXX deploy to production after freeze ends
when: env == "staging"
tags:
- cgit
# Various app redirects
- role: httpd/redirect

View file

@ -0,0 +1,19 @@
RewriteEngine on
# commit ID
RewriteCond %{QUERY_STRING} (^|&)id=([^&]+)($|&)
RewriteRule ^/cgit/([-._+a-zA-Z0-9/]+)\.git/commit/?$ /$1/c/%2? [R,L]
# plain file at commit ID
RewriteCond %{QUERY_STRING} (^|&)id=([^&]+)($|&)
RewriteRule ^/cgit/([-._+a-zA-Z0-9/]+)\.git/plain/(.*) /$1/raw/%2/f/$2? [R,L]
# plain file at ref
RewriteCond %{QUERY_STRING} (^|&)h=([^&]+)($|&)
RewriteRule ^/cgit/([-._+a-zA-Z0-9/]+)\.git/plain/(.*) /$1/raw/%2/f/$2? [R,L]
# plain file at HEAD
RewriteRule ^/cgit/([-._+a-zA-Z0-9/]+)\.git/plain/(.*) /$1/raw/HEAD/f/$2? [R,L]
# main project page
RewriteRule ^/cgit/([-._+a-zA-Z0-9/]+)\.git/?$ /$1? [R,L]