flake/hosts/tyo0/services/redlib.nix

30 lines
693 B
Nix
Raw Permalink Normal View History

2024-09-06 12:19:44 +00:00
{ lib, config, ... }:
let
port = config.lib.ports.redlib;
in
2024-08-27 09:08:53 +00:00
{
services.redlib = {
2024-09-06 12:19:44 +00:00
inherit port;
2024-08-27 09:08:53 +00:00
enable = true;
address = "127.0.0.1";
};
2024-08-31 02:15:09 +00:00
services.caddy.settings.apps.http.servers.srv0.routes = lib.singleton {
match = lib.singleton {
host = [ "reddit.ny4.dev" ];
};
2024-09-06 13:20:51 +00:00
handle = [
{
# Google's indexing caused a DoS with 800k requests...
# https://developers.google.com/search/docs/crawling-indexing/block-indexing
handler = "headers";
response.set."X-Robots-Tag" = [ "noindex" ];
}
{
handler = "reverse_proxy";
upstreams = [ { dial = "localhost:${toString port}"; } ];
}
];
2024-08-31 02:15:09 +00:00
};
2024-08-27 09:08:53 +00:00
}