about summary refs log tree commit diff
path: root/modules/services/cgit/default.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-06-23 19:20:40 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-23 19:22:22 -0700
commit42f23754c11ac72c367742407769e09d71815954 (patch)
tree9f730c03e056c193c4a054f6e9059ef94e92ef28 /modules/services/cgit/default.nix
parentfix(modules/cgit): exclude all web crawlers (diff)
downloadworld-42f23754c11ac72c367742407769e09d71815954.tar.gz
fix(modules/cgit): correct alias configuration for robots.txt
As noted in
https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md

> if you want to map a single file make sure the location starts with a
> =, e.g =/i.gif instead of /i.gif

Without a leading `=`, the configuration refuses to build.

Change-Id: Ib49f68fbe26441ff6c3ee91efa1d12c3778a0248
Reviewed-on: https://cl.fcuny.net/c/world/+/489
Reviewed-by: Franck Cuny <franck@fcuny.net>
Tested-by: CI
Diffstat (limited to 'modules/services/cgit/default.nix')
-rw-r--r--modules/services/cgit/default.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/services/cgit/default.nix b/modules/services/cgit/default.nix
index 39e1633..704d0dc 100644
--- a/modules/services/cgit/default.nix
+++ b/modules/services/cgit/default.nix
@@ -109,7 +109,9 @@ in
       enableACME = true;
       locations = {
         "~* ^.+.(css|png|ico)$" = { root = "${pkgs.cgit}/cgit"; };
-        "/robots.txt".alias = robots-deny;
+        # as per https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md
+        # if you want to map a single file make sure the location starts with a =, e.g =/i.gif instead of /i.gif.
+        "=/robots.txt".alias = robots-deny;
         "/".extraConfig = ''
           include ${pkgs.nginx}/conf/fastcgi_params;
           fastcgi_param CGIT_CONFIG ${pkgs.writeText "cgitrc" cgitrc};