Files
nixos-servers/services/http-proxy/proxy.nix
Torjus Håkestad 16ef202530
Some checks failed
Run nix flake check / flake-check (push) Failing after 3m23s
http-proxy: set content-type header on maintenance page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 12:43:12 +01:00

112 lines
2.9 KiB
Nix
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ pkgs, ... }:
{
services.caddy = {
enable = true;
package = pkgs.unstable.caddy;
configFile = pkgs.writeText "Caddyfile" ''
{
acme_ca https://vault.home.2rjus.net:8200/v1/pki_int/acme/directory
metrics {
per_host
}
}
nzbget.home.2rjus.net {
log {
output file /var/log/caddy/nzbget.log {
mode 644
}
}
reverse_proxy http://nzbget-jail.home.2rjus.net:6789
}
radarr.home.2rjus.net {
log {
output file /var/log/caddy/radarr.log {
mode 644
}
}
reverse_proxy http://radarr-jail.home.2rjus.net:7878
}
sonarr.home.2rjus.net {
log {
output file /var/log/caddy/sonarr.log {
mode 644
}
}
reverse_proxy http://sonarr-jail.home.2rjus.net:8989
}
ha.home.2rjus.net {
log {
output file /var/log/caddy/ha.log {
mode 644
}
}
reverse_proxy http://ha1.home.2rjus.net:8123
}
z2m.home.2rjus.net {
log {
output file /var/log/caddy/z2m.log {
mode 644
}
}
reverse_proxy http://ha1.home.2rjus.net:8080
}
jelly.home.2rjus.net {
log {
output file /var/log/caddy/jelly.log {
mode 644
}
}
header Content-Type text/html
respond <<HTML
<!DOCTYPE html>
<html>
<head>
<title>Jellyfin - Maintenance</title>
<style>
body {
background: #101020;
color: #ddd;
font-family: sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
text-align: center;
}
.container { max-width: 500px; }
.disk { font-size: 80px; animation: spin 3s linear infinite; display: inline-block; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
h1 { color: #00a4dc; }
p { font-size: 1.2em; line-height: 1.6; }
</style>
</head>
<body>
<div class="container">
<div class="disk">&#x1F4BF;</div>
<h1>Jellyfin is taking a nap</h1>
<p>The NAS is getting shiny new hard drives.<br>
Jellyfin will be back once the disks stop spinning up.</p>
<p style="color:#666;font-size:0.9em;">In the meantime, maybe go outside?</p>
</div>
</body>
</html>
HTML 200
}
http://http-proxy.home.2rjus.net/metrics {
log {
output file /var/log/caddy/caddy-metrics.log {
mode 644
}
}
metrics
}
'';
};
}