mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
add initial caddyfile
This commit is contained in:
parent
f40a9d8a5a
commit
77349735e1
1 changed files with 40 additions and 0 deletions
40
installation/Caddyfile
Normal file
40
installation/Caddyfile
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
example.com {
|
||||
root * /opt/ditto/public
|
||||
|
||||
# Static file serving for /packs
|
||||
handle_path /packs* {
|
||||
root * /opt/ditto/public
|
||||
header {
|
||||
Cache-Control "public, max-age=31536000, immutable"
|
||||
Strict-Transport-Security "max-age=31536000"
|
||||
}
|
||||
file_server
|
||||
}
|
||||
|
||||
# Special handling for instance files and service workers
|
||||
handle_path /{instance,sw.js,sw.js.map} {
|
||||
root * /opt/ditto/public
|
||||
file_server
|
||||
}
|
||||
|
||||
# Metrics endpoint, restricted to localhost
|
||||
handle_path /metrics {
|
||||
@localOnly {
|
||||
remote_ip 127.0.0.1
|
||||
}
|
||||
reverse_proxy @localOnly 127.0.0.1:4036
|
||||
}
|
||||
|
||||
# Proxy all other requests to the upstream Ditto server
|
||||
handle {
|
||||
reverse_proxy 127.0.0.1:4036 {
|
||||
header_up Host {host}
|
||||
header_up X-Real-IP {remote_host}
|
||||
header_up X-Forwarded-For {remote_host}
|
||||
header_up X-Forwarded-Proto {scheme}
|
||||
}
|
||||
}
|
||||
|
||||
# Enable gzip compression for responses
|
||||
encode gzip
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue