From 4b6930b896b7a4bea9791d9cfb6dac207e5e992e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gamez?= Date: Thu, 5 Jan 2023 20:33:07 +0100 Subject: [PATCH] Update Caddy reverse proxy config to exclude root path for static files --- docs/best-practices/deployment.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/docs/best-practices/deployment.md b/docs/best-practices/deployment.md index 2932b64..746f4e3 100644 --- a/docs/best-practices/deployment.md +++ b/docs/best-practices/deployment.md @@ -467,20 +467,18 @@ achieved by using a `Caddyfile` configuration with the following contents: ``` example.com { - root * /var/www/html/public; + root * /var/www/html/public - @static { - file {path} {path}/ - not path *.php - } - handle @static { - rewrite * {http.matchers.file.relative} - file_server - } - - handle { - reverse_proxy localhost:8080 - } + encode gzip + + @static `!path("*.php") && file() && {file_match.type} == "file"` + handle @static { + file_server + } + + handle { + reverse_proxy localhost:8080 + } } ```