A stream.place client in a single index.html
1{
2 admin off
3 persist_config off
4 auto_https off
5
6 log {
7 format json
8 }
9
10 servers {
11 trusted_proxies static private_ranges
12 }
13}
14
15:{$PORT:80} {
16 log {
17 format json
18 }
19
20 respond /health 200
21
22 # Security headers
23 header {
24 # Enable cross-site filter (XSS) and tell browsers to block detected attacks
25 X-XSS-Protection "1; mode=block"
26 # Prevent some browsers from MIME-sniffing a response away from the declared Content-Type
27 X-Content-Type-Options "nosniff"
28 # Keep referrer data off of HTTP connections
29 Referrer-Policy "strict-origin-when-cross-origin"
30 # Enable strict Content Security Policy
31 Content-Security-Policy "default-src 'self'; img-src 'self' data: https: *; style-src 'self' 'unsafe-inline' https: *; script-src 'self' 'unsafe-inline' https: *; font-src 'self' data: https: *; connect-src 'self' https: *; media-src 'self' https: *; object-src 'none'; frame-src 'self' https: *;"
32 # Remove Server header
33 -Server
34 }
35
36 root * .
37
38 # Handle static files
39 file_server {
40 hide .git
41 hide .env*
42 }
43
44 # Compression with more formats
45 encode {
46 gzip
47 zstd
48 }
49
50 # Try files with HTML extension and handle SPA routing
51 try_files {path} {path}.html {path}/index.html /index.html
52
53 # Handle 404 errors
54 handle_errors {
55 rewrite * /{err.status_code}.html
56 file_server
57 }
58}