Serve static files with Caddy

This commit is contained in:
TEC 2022-10-17 00:35:18 +08:00
parent 77bffc8c84
commit abd49debb7
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
2 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -74,12 +74,20 @@ 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 🙂.