Caddy: improve error handling and start working on language redirect for homepage
This commit is contained in:
parent
9760f03c00
commit
ff510d3b02
1 changed files with 35 additions and 10 deletions
|
@ -22,6 +22,16 @@ korhonen.cc, *.korhonen.cc {
|
||||||
|
|
||||||
@homepage host korhonen.cc
|
@homepage host korhonen.cc
|
||||||
handle @homepage {
|
handle @homepage {
|
||||||
|
# Redirect finnish WIP
|
||||||
|
# @redirFinnish {
|
||||||
|
# header Accept-Language *fi-FI*
|
||||||
|
# not path *.js *.css *.png *.jpg *.jpeg *.svg
|
||||||
|
# not path /en* /fi*
|
||||||
|
# }
|
||||||
|
# redir @redirFinnish /fi{uri}
|
||||||
|
#
|
||||||
|
# uri strip_prefix /en
|
||||||
|
|
||||||
header @static Cache-Control max-age=5184000
|
header @static Cache-Control max-age=5184000
|
||||||
root * /var/www/korhonen.cc
|
root * /var/www/korhonen.cc
|
||||||
file_server
|
file_server
|
||||||
|
@ -142,15 +152,22 @@ korhonen.cc, *.korhonen.cc {
|
||||||
reverse_proxy drop:3000
|
reverse_proxy drop:3000
|
||||||
}
|
}
|
||||||
|
|
||||||
# Redirect to new fediverse host
|
handle {
|
||||||
@misskey host social.korhonen.cc
|
respond "404 Not Found" 404
|
||||||
handle @misskey {
|
|
||||||
redir https://korhonen.social
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fallback for unhandled domains
|
handle_errors {
|
||||||
handle {
|
@homepage_404 {
|
||||||
redir https://korhonen.cc/404.html 301
|
expression {http.error.status_code} == 404
|
||||||
|
host korhonen.cc
|
||||||
|
}
|
||||||
|
handle @homepage_404 {
|
||||||
|
root * /var/www/korhonen.cc
|
||||||
|
rewrite * /404.html
|
||||||
|
file_server
|
||||||
|
}
|
||||||
|
|
||||||
|
respond "{err.status_code} {err.status_text}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,4 +192,12 @@ korhonen.social, *.korhonen.social {
|
||||||
handle @firefish {
|
handle @firefish {
|
||||||
reverse_proxy firefish:3000
|
reverse_proxy firefish:3000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle {
|
||||||
|
respond "404 Not Found" 404
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_errors {
|
||||||
|
respond "{err.status_code} {err.status_text}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue