my nixos dotfiles :3 (git.koi.rip mirror) git.koi.rip/koi/dotfiles
linux dotfiles neovim nixos catppuccin

seber: ebil pages index.txt support

+17 -4
+17 -4
systems/seber/services/ebil-club.nix
··· 24 services.nginx.virtualHosts = { 25 "${servedHost}" = ( 26 { 27 - locations."/" = { 28 - root = rootDir; 29 - index = "index.html"; 30 - extraConfig = "try_files $uri $uri/ =404;"; 31 }; 32 extraConfig = "error_page 404 /404.html;"; 33 }
··· 24 services.nginx.virtualHosts = { 25 "${servedHost}" = ( 26 { 27 + locations = { 28 + "/" = { 29 + root = rootDir; 30 + index = "index.html"; 31 + extraConfig = '' 32 + if ($http_user_agent ~* "curl") { 33 + rewrite ^ /index.txt last; 34 + } 35 + try_files $uri $uri/ =404; 36 + ''; 37 + }; 38 + "/index.txt" = { 39 + root = rootDir; 40 + extraConfig = "try_files /index.txt @curl_fallback;"; 41 + }; 42 + "@curl_fallback".return = 43 + "200 'hi! this site is best viewed in a web browser :3 if u still want to curl it, try setting a different user-agent header'"; 44 }; 45 extraConfig = "error_page 404 /404.html;"; 46 }