Add HTTP error redirection to CADDY

This commit is contained in:
TEC 2022-10-17 01:03:21 +08:00
parent 66eac8831b
commit 5bf5186599
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
2 changed files with 18 additions and 0 deletions

View File

@ -9,3 +9,10 @@ reverse_proxy @dynamic localhost:8000
root * /opt/emacs-survey/public
file_server
handle_errors {
rewrite * /{err.status_code}
reverse_proxy https://http.cat {
header_up Host {upstream_hostport}
}
}

View File

@ -99,6 +99,17 @@ root * /opt/emacs-survey/public
file_server
#+end_src
For HTTP errors we could re-use the Genie error pages ... or have some fun 🐱.
#+begin_src prog
handle_errors {
rewrite * /{err.status_code}
reverse_proxy https://http.cat {
header_up Host {upstream_hostport}
}
}
#+end_src
Just this one file is all it takes to get Caddy set up to our liking 🙂.
#+begin_src sh