From b08e8ba06ba04f7edf10ae8b41ef3c5d8014117c Mon Sep 17 00:00:00 2001 From: Koala <6156589+Shik3i@users.noreply.github.com> Date: Mon, 1 Jun 2026 01:20:14 +0200 Subject: [PATCH] docs: update advanced caddyfile configuration for syncserver in example and website --- Caddyfile.example | 44 ++++++++++++++++++------------------ website/template.html | 29 ++++++++++++++++++------ website/www/de/index.html | 29 ++++++++++++++++++------ website/www/es/index.html | 29 ++++++++++++++++++------ website/www/fr/index.html | 29 ++++++++++++++++++------ website/www/index.html | 29 ++++++++++++++++++------ website/www/pt-BR/index.html | 29 ++++++++++++++++++------ website/www/ru/index.html | 29 ++++++++++++++++++------ 8 files changed, 176 insertions(+), 71 deletions(-) diff --git a/Caddyfile.example b/Caddyfile.example index e7395eb..99b081d 100644 --- a/Caddyfile.example +++ b/Caddyfile.example @@ -32,6 +32,23 @@ # aggressive static assets caching, server signature concealment, and strict # hardware permission access policies. +(security_headers) { + header { + # Enable HTTP Strict Transport Security (HSTS) + Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" + # Prevent clickjacking attacks (Sameorigin) + X-Frame-Options "SAMEORIGIN" + # Prevent MIME-sniffing + X-Content-Type-Options "nosniff" + # Enable browser XSS protection + X-XSS-Protection "1; mode=block" + # Control referrer information + Referrer-Policy "strict-origin-when-cross-origin" + # Hide Caddy server stamp signature + -Server + } +} + sync.koalastuff.net { encode zstd gzip root * /var/www/koalasync/website/www @@ -48,36 +65,19 @@ sync.koalastuff.net { header @static Cache-Control "public, max-age=31536000, must-revalidate" # Security Headers & Content Security Policy (CSP) + import security_headers header { # CSP hardened with base-uri and form-action limits Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';" - # Strict Transport Security (HSTS) - Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" - - # Security best practices - X-Frame-Options "DENY" - X-Content-Type-Options "nosniff" - Referrer-Policy "strict-origin-when-cross-origin" - # Modern Permissions Policy (blocks browser hardware access for enhanced privacy) Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()" - - # Remove Caddy's server stamp signature - -Server } } syncserver.koalastuff.net { - reverse_proxy localhost:3000 { - header_up Host {host} - header_up X-Real-IP {remote_host} - } - - header { - X-Content-Type-Options "nosniff" - X-Frame-Options "DENY" - Referrer-Policy "strict-origin-when-cross-origin" - -Server - } + import security_headers + encode zstd gzip + reverse_proxy KoalaSync:3000 } + diff --git a/website/template.html b/website/template.html index abf78ff..56e0860 100644 --- a/website/template.html +++ b/website/template.html @@ -961,7 +961,24 @@
sync.koalastuff.net {
+ (security_headers) {
+ header {
+ # Enable HTTP Strict Transport Security (HSTS)
+ Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
+ # Prevent clickjacking attacks (Sameorigin)
+ X-Frame-Options "SAMEORIGIN"
+ # Prevent MIME-sniffing
+ X-Content-Type-Options "nosniff"
+ # Enable browser XSS protection
+ X-XSS-Protection "1; mode=block"
+ # Control referrer information
+ Referrer-Policy "strict-origin-when-cross-origin"
+ # Hide Caddy server stamp signature
+ -Server
+ }
+}
+
+sync.koalastuff.net {
encode zstd gzip
root * /var/www/koalasync/website/www
@@ -977,19 +994,17 @@
header @static Cache-Control "public, max-age=31536000, must-revalidate"
# Hardened Security & Permission Policies
+ import security_headers
header {
Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';"
- Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
- X-Frame-Options "DENY"
- X-Content-Type-Options "nosniff"
- Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
- -Server
}
}
syncserver.koalastuff.net {
- reverse_proxy localhost:3000
+ import security_headers
+ encode zstd gzip
+ reverse_proxy KoalaSync:3000
}
sync.koalastuff.net {
+ (security_headers) {
+ header {
+ # Enable HTTP Strict Transport Security (HSTS)
+ Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
+ # Prevent clickjacking attacks (Sameorigin)
+ X-Frame-Options "SAMEORIGIN"
+ # Prevent MIME-sniffing
+ X-Content-Type-Options "nosniff"
+ # Enable browser XSS protection
+ X-XSS-Protection "1; mode=block"
+ # Control referrer information
+ Referrer-Policy "strict-origin-when-cross-origin"
+ # Hide Caddy server stamp signature
+ -Server
+ }
+}
+
+sync.koalastuff.net {
encode zstd gzip
root * /var/www/koalasync/website/www
@@ -977,19 +994,17 @@
header @static Cache-Control "public, max-age=31536000, must-revalidate"
# Hardened Security & Permission Policies
+ import security_headers
header {
Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';"
- Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
- X-Frame-Options "DENY"
- X-Content-Type-Options "nosniff"
- Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
- -Server
}
}
syncserver.koalastuff.net {
- reverse_proxy localhost:3000
+ import security_headers
+ encode zstd gzip
+ reverse_proxy KoalaSync:3000
}
sync.koalastuff.net {
+ (security_headers) {
+ header {
+ # Enable HTTP Strict Transport Security (HSTS)
+ Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
+ # Prevent clickjacking attacks (Sameorigin)
+ X-Frame-Options "SAMEORIGIN"
+ # Prevent MIME-sniffing
+ X-Content-Type-Options "nosniff"
+ # Enable browser XSS protection
+ X-XSS-Protection "1; mode=block"
+ # Control referrer information
+ Referrer-Policy "strict-origin-when-cross-origin"
+ # Hide Caddy server stamp signature
+ -Server
+ }
+}
+
+sync.koalastuff.net {
encode zstd gzip
root * /var/www/koalasync/website/www
@@ -977,19 +994,17 @@
header @static Cache-Control "public, max-age=31536000, must-revalidate"
# Hardened Security & Permission Policies
+ import security_headers
header {
Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';"
- Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
- X-Frame-Options "DENY"
- X-Content-Type-Options "nosniff"
- Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
- -Server
}
}
syncserver.koalastuff.net {
- reverse_proxy localhost:3000
+ import security_headers
+ encode zstd gzip
+ reverse_proxy KoalaSync:3000
}
sync.koalastuff.net {
+ (security_headers) {
+ header {
+ # Enable HTTP Strict Transport Security (HSTS)
+ Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
+ # Prevent clickjacking attacks (Sameorigin)
+ X-Frame-Options "SAMEORIGIN"
+ # Prevent MIME-sniffing
+ X-Content-Type-Options "nosniff"
+ # Enable browser XSS protection
+ X-XSS-Protection "1; mode=block"
+ # Control referrer information
+ Referrer-Policy "strict-origin-when-cross-origin"
+ # Hide Caddy server stamp signature
+ -Server
+ }
+}
+
+sync.koalastuff.net {
encode zstd gzip
root * /var/www/koalasync/website/www
@@ -977,19 +994,17 @@
header @static Cache-Control "public, max-age=31536000, must-revalidate"
# Hardened Security & Permission Policies
+ import security_headers
header {
Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';"
- Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
- X-Frame-Options "DENY"
- X-Content-Type-Options "nosniff"
- Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
- -Server
}
}
syncserver.koalastuff.net {
- reverse_proxy localhost:3000
+ import security_headers
+ encode zstd gzip
+ reverse_proxy KoalaSync:3000
}
sync.koalastuff.net {
+ (security_headers) {
+ header {
+ # Enable HTTP Strict Transport Security (HSTS)
+ Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
+ # Prevent clickjacking attacks (Sameorigin)
+ X-Frame-Options "SAMEORIGIN"
+ # Prevent MIME-sniffing
+ X-Content-Type-Options "nosniff"
+ # Enable browser XSS protection
+ X-XSS-Protection "1; mode=block"
+ # Control referrer information
+ Referrer-Policy "strict-origin-when-cross-origin"
+ # Hide Caddy server stamp signature
+ -Server
+ }
+}
+
+sync.koalastuff.net {
encode zstd gzip
root * /var/www/koalasync/website/www
@@ -977,19 +994,17 @@
header @static Cache-Control "public, max-age=31536000, must-revalidate"
# Hardened Security & Permission Policies
+ import security_headers
header {
Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';"
- Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
- X-Frame-Options "DENY"
- X-Content-Type-Options "nosniff"
- Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
- -Server
}
}
syncserver.koalastuff.net {
- reverse_proxy localhost:3000
+ import security_headers
+ encode zstd gzip
+ reverse_proxy KoalaSync:3000
}
sync.koalastuff.net {
+ (security_headers) {
+ header {
+ # Enable HTTP Strict Transport Security (HSTS)
+ Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
+ # Prevent clickjacking attacks (Sameorigin)
+ X-Frame-Options "SAMEORIGIN"
+ # Prevent MIME-sniffing
+ X-Content-Type-Options "nosniff"
+ # Enable browser XSS protection
+ X-XSS-Protection "1; mode=block"
+ # Control referrer information
+ Referrer-Policy "strict-origin-when-cross-origin"
+ # Hide Caddy server stamp signature
+ -Server
+ }
+}
+
+sync.koalastuff.net {
encode zstd gzip
root * /var/www/koalasync/website/www
@@ -977,19 +994,17 @@
header @static Cache-Control "public, max-age=31536000, must-revalidate"
# Hardened Security & Permission Policies
+ import security_headers
header {
Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';"
- Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
- X-Frame-Options "DENY"
- X-Content-Type-Options "nosniff"
- Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
- -Server
}
}
syncserver.koalastuff.net {
- reverse_proxy localhost:3000
+ import security_headers
+ encode zstd gzip
+ reverse_proxy KoalaSync:3000
}
sync.koalastuff.net {
+ (security_headers) {
+ header {
+ # Enable HTTP Strict Transport Security (HSTS)
+ Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
+ # Prevent clickjacking attacks (Sameorigin)
+ X-Frame-Options "SAMEORIGIN"
+ # Prevent MIME-sniffing
+ X-Content-Type-Options "nosniff"
+ # Enable browser XSS protection
+ X-XSS-Protection "1; mode=block"
+ # Control referrer information
+ Referrer-Policy "strict-origin-when-cross-origin"
+ # Hide Caddy server stamp signature
+ -Server
+ }
+}
+
+sync.koalastuff.net {
encode zstd gzip
root * /var/www/koalasync/website/www
@@ -977,19 +994,17 @@
header @static Cache-Control "public, max-age=31536000, must-revalidate"
# Hardened Security & Permission Policies
+ import security_headers
header {
Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';"
- Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
- X-Frame-Options "DENY"
- X-Content-Type-Options "nosniff"
- Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
- -Server
}
}
syncserver.koalastuff.net {
- reverse_proxy localhost:3000
+ import security_headers
+ encode zstd gzip
+ reverse_proxy KoalaSync:3000
}