Skip to content

Commit 41b23c4

Browse files
committed
Update Caddy reverse proxy config to exclude root path for static files
1 parent 9e97ad3 commit 41b23c4

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

docs/best-practices/deployment.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -467,20 +467,18 @@ achieved by using a `Caddyfile` configuration with the following contents:
467467

468468
```
469469
example.com {
470-
root * /var/www/html/public;
470+
root * /var/www/html/public
471471
472-
@static {
473-
file {path} {path}/
474-
not path *.php
475-
}
476-
handle @static {
477-
rewrite * {http.matchers.file.relative}
478-
file_server
479-
}
480-
481-
handle {
482-
reverse_proxy localhost:8080
483-
}
472+
encode gzip
473+
474+
@static `!path("*.php") && file() && {file_match.type} == "file"`
475+
handle @static {
476+
file_server
477+
}
478+
479+
handle {
480+
reverse_proxy localhost:8080
481+
}
484482
}
485483
```
486484

0 commit comments

Comments
 (0)