Skip to content

Commit de26433

Browse files
committed
chore: Update Caddy server configuration and Restic backup script.
1 parent f7a39ea commit de26433

2 files changed

Lines changed: 25 additions & 30 deletions

File tree

config/Caddyfile

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,31 @@
2828
}
2929

3030
# Domain Access Control
31-
# Allow if CADDY_DOMAINS is empty OR host matches (using :localhost to avoid empty host error)
32-
@allowed expression {env.CADDY_DOMAINS} == "" || host("{$CADDY_DOMAINS:localhost}")
33-
34-
# Main Application Logic (Only for allowed domains)
35-
handle @allowed {
36-
encode zstd gzip
37-
38-
# Harden security posture
39-
header {
40-
Strict-Transport-Security "max-age=31536000;"
41-
X-Content-Type-Options "nosniff"
42-
X-Frame-Options "DENY"
43-
X-XSS-Protection "1; mode=block"
44-
Referrer-Policy "strict-origin-when-cross-origin"
45-
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()"
46-
X-Robots-Tag "noindex, nofollow"
47-
-Server
48-
-X-Powered-By
49-
-Last-Modified
50-
}
51-
52-
# Proxy to the application backend
53-
reverse_proxy 127.0.0.1:8080 {
54-
header_up X-Real-IP {http.request.header.Fly-Client-IP}
55-
header_up X-Forwarded-For {http.request.header.Fly-Client-IP}
56-
}
31+
@denied {
32+
expression {env.CADDY_DOMAINS} != ""
33+
not host {$CADDY_DOMAINS:localhost}
34+
}
35+
respond @denied "Access Denied: Domain not allowed" 403
36+
37+
encode zstd gzip
38+
39+
# Harden security posture
40+
header {
41+
Strict-Transport-Security "max-age=31536000;"
42+
X-Content-Type-Options "nosniff"
43+
X-Frame-Options "DENY"
44+
X-XSS-Protection "1; mode=block"
45+
Referrer-Policy "strict-origin-when-cross-origin"
46+
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()"
47+
X-Robots-Tag "noindex, nofollow"
48+
-Server
49+
-X-Powered-By
50+
-Last-Modified
5751
}
5852

59-
# Fallback for denied domains
60-
handle {
61-
respond "Access Denied: Domain not allowed" 403
53+
# Proxy to the application backend
54+
reverse_proxy 127.0.0.1:8080 {
55+
header_up X-Real-IP {http.request.header.Fly-Client-IP}
56+
header_up X-Forwarded-For {http.request.header.Fly-Client-IP}
6257
}
6358
}

scripts/restic.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
set -o pipefail
88

99
# ── Configuration ─────────────────────────────────────────────────────────────
10-
APP_NAME="Gotify"
10+
APP_NAME="${FLY_APP_NAME:-Gotify}"
1111
DATA="/app/data"
1212
LOG_DIR="/var/log/restic"
1313
LOG="$LOG_DIR/$(date +%Y%m%d_%H%M%S).log"

0 commit comments

Comments
 (0)