From a1cce9efb568fcda557c0850b91382dade8b61ec Mon Sep 17 00:00:00 2001 From: TEC Date: Mon, 17 Oct 2022 00:35:18 +0800 Subject: [PATCH] Serve static files with Caddy --- Caddyfile | 6 +++++- setup.org | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Caddyfile b/Caddyfile index 3a9bea3..feccd36 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,3 +1,7 @@ emacssurvey.tecosaur.net -reverse_proxy localhost:8000 +@dynamic { not path /css/* } +reverse_proxy @dynamic localhost:8000 + +root /css/* /opt/emacs-survey/public/css/ +file_server /css/style.css diff --git a/setup.org b/setup.org index 226300c..ab16f30 100644 --- a/setup.org +++ b/setup.org @@ -74,12 +74,18 @@ SETUPDIR=$(dirname "$(readlink --canonicalize-existing "$0")") ** Caddy Config We just need to redirect to Genie for now, which makes for a rather simple -config. +config. The only complication is serving the static files through Caddy not +Genie, for performance reasons (Genie recommends against serving static files +with it). #+begin_src prog :tangle Caddyfile emacssurvey.tecosaur.net -reverse_proxy localhost:8000 +@dynamic { not path /css/* } +reverse_proxy @dynamic localhost:8000 + +root /css/* /opt/emacs-survey/public/css/ +file_server /css/style.css #+end_src Just this one file is all it takes to get Caddy set up to our liking 🙂.