summaryrefslogtreecommitdiff
path: root/nginx
diff options
context:
space:
mode:
Diffstat (limited to 'nginx')
-rw-r--r--nginx/nginx.conf12
1 files changed, 12 insertions, 0 deletions
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
index ea83fd1..8112e28 100644
--- a/nginx/nginx.conf
+++ b/nginx/nginx.conf
@@ -54,12 +54,24 @@ server {
}
# Cgit via path prefix on main domain
+ # cgit generates links from virtual-root=/ so we rewrite them to /cgit/
location /cgit {
proxy_pass http://cgit:80/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
+
+ # Rewrite cgit links to include /cgit prefix
+ sub_filter 'href="/' 'href="/cgit/';
+ sub_filter "href='/" "href='/cgit/";
+ sub_filter 'action="/' 'action="/cgit/';
+ sub_filter "action='/" "action='/cgit/";
+ sub_filter_once off;
+ sub_filter_types text/html;
+
+ # Rewrite any redirects from cgit itself
+ proxy_redirect / /cgit/;
}
# Gerrit via path prefix on main domain