about summary refs log tree commit diff
path: root/infra/kubernetes/nginx
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-20T18·42+0000
committerVincent Ambo <tazjin@google.com>2019-12-20T18·42+0000
commitc3586aa8bacb9f2b882c81c938e4c89ad3d95675 (patch)
treeb4cf5a8ec243a00b4bbdb767c956f78a8f1d7c47 /infra/kubernetes/nginx
parent0dee62cd7b789756864deddb1d7f32293489d735 (diff)
feat(infra/k8s): Rewrite cgit URLs by routing them through nginx r/229
Configures nginx to rewrite all requests to cgit, except for those
retrieving static files, to `/depot/`.

In combination with the previous commits that apply patches to cgit
itself, this effectively means that the depot is rendered on the site
root.

This is pretty cool: It lets people do stuff like `git clone
https://git.tazj.in` and get the depot!
Diffstat (limited to 'infra/kubernetes/nginx')
-rw-r--r--infra/kubernetes/nginx/nginx.conf15
1 files changed, 15 insertions, 0 deletions
diff --git a/infra/kubernetes/nginx/nginx.conf b/infra/kubernetes/nginx/nginx.conf
index ead5c4061720..918aa6067806 100644
--- a/infra/kubernetes/nginx/nginx.conf
+++ b/infra/kubernetes/nginx/nginx.conf
@@ -41,4 +41,19 @@ http {
             return 302 https://www.google.com/maps/d/viewer?mid=1pJIYY9cuEdt9DuMTbb4etBVq7hs;
         }
     }
+
+    server {
+        listen       80;
+        server_name  git.tazj.in;
+
+        # Static assets must always hit the root.
+        location ~ ^/(favicon\.ico|cgit\.(css|png))$ {
+           proxy_pass http://cgit;
+        }
+
+        # Everything else hits the depot directly.
+        location / {
+            proxy_pass http://cgit/cgit.cgi/depot/;
+        }
+    }
 }