From 66eac8831b8062acd157773419b844a22c771197 Mon Sep 17 00:00:00 2001 From: TEC Date: Mon, 17 Oct 2022 00:58:19 +0800 Subject: [PATCH] Improve static file matching --- Caddyfile | 6 ++++-- setup.org | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Caddyfile b/Caddyfile index 31352ee..2561932 100644 --- a/Caddyfile +++ b/Caddyfile @@ -2,8 +2,10 @@ emacssurvey.tecosaur.net @dynamic { not path /css/* + not path /favicon.ico + not path /robots.txt } reverse_proxy @dynamic localhost:8000 -root /css/* /opt/emacs-survey/public/css/ -file_server /css/style.css +root * /opt/emacs-survey/public +file_server diff --git a/setup.org b/setup.org index 198eec3..f8d9240 100644 --- a/setup.org +++ b/setup.org @@ -72,22 +72,31 @@ SETUPDIR=$(dirname "$(readlink --canonicalize-existing "$0")") #+end_src ** Caddy Config +:PROPERTIES: +:header-args:prog: :tangle Caddyfile +:END: We just need to redirect to Genie for now, which makes for a rather simple 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 +#+begin_src prog emacssurvey.tecosaur.net @dynamic { not path /css/* + not path /favicon.ico + not path /robots.txt } reverse_proxy @dynamic localhost:8000 +#+end_src -root /css/* /opt/emacs-survey/public/css/ -file_server /css/style.css +We'll just pass all other requests to the public folder of the Emacs Survey. + +#+begin_src prog +root * /opt/emacs-survey/public +file_server #+end_src Just this one file is all it takes to get Caddy set up to our liking 🙂.