summaryrefslogtreecommitdiff
path: root/etc/caddy/Caddyfile
blob: e353f94cd7679e17b8ac288a16dbe34daf999f38 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  log {
    # set to DEBUG for testing
    level INFO
  }
}

code.webb.page {
  @assets path /cgit.css /cgit.js /cgit.png /favicon.svg /head.html /og.png /robots.txt

  @git {
    path_regexp ^/.*/(HEAD|info/refs|objects/info/[^/]+|git-upload-pack)$
  }

  @git_static {
    path_regexp ^/.*/objects/([0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$
  }

  handle @assets {
    root * /var/www/cgit
    file_server
  }

  handle @git_static {
    root * /srv/git
    file_server
  }

  handle @git {
    reverse_proxy unix//run/fcgiwrap.socket {
      transport fastcgi {
        env DOCUMENT_ROOT /srv/git
        env GIT_HTTP_EXPORT_ALL 1
        env GIT_PROJECT_ROOT /srv/git
        env SCRIPT_FILENAME /usr/lib/git-core/git-http-backend
      }
    }
  }

  reverse_proxy unix//run/fcgiwrap.socket {
    transport fastcgi {
      env SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi
    }
  }
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile