From 645b10f2b929d230830863596e91ef4b4d7bdf6f Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 21 Jan 2023 23:22:50 +0100 Subject: [PATCH] flora-6: update Caddyfile, add missing pub.solar config for www and mastodon well-known redirect --- hosts/flora-6/caddy.nix | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/hosts/flora-6/caddy.nix b/hosts/flora-6/caddy.nix index f1d88b8d..a8f2fde0 100644 --- a/hosts/flora-6/caddy.nix +++ b/hosts/flora-6/caddy.nix @@ -15,8 +15,34 @@ output discard ''; extraConfig = '' - root * /srv/www/pub.solar/ - file_server + # PubSolarOS images + handle /os/download/* { + root * /srv/www + file_server /os/download/* browse + } + # serve base domain pub.solar for mastodon.pub.solar + # https://masto.host/mastodon-usernames-different-from-the-domain-used-for-installation/ + handle /.well-known/host-meta { + redir https://mastodon.pub.solar{uri} + } + # pub.solar website + handle { + root * /srv/www/pub.solar + try_files {path}.html {path} + file_server + } + # minimal error handling, respond with status code and text + handle_errors { + respond "{http.error.status_code} {http.error.status_text}" + } + ''; + }; + "www.pub.solar" = { + logFormat = lib.mkForce '' + output discard + ''; + extraConfig = '' + redir https://pub.solar{uri} ''; }; "auth.pub.solar" = {