-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
1350 lines (1290 loc) · 73.7 KB
/
index.html
File metadata and controls
1350 lines (1290 loc) · 73.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>static-web — High-Performance Go Static File Server</title>
<meta
name="description"
content="Production-grade, blazing-fast static web file server written in Go. ~148k req/sec with fasthttp — 59% faster than Bun. In-memory LRU cache, HTTP/2, TLS 1.2+, gzip/brotli, security headers — built on fasthttp for maximum throughput."
/>
<meta
name="keywords"
content="static file server, go, golang, http2, tls, lru cache, gzip, brotli, performance, security, web server, static site hosting, docker"
/>
<meta name="author" content="21no.de" />
<meta name="robots" content="index, follow" />
<link rel="canonical" href="https://static.21no.de" />
<!-- Open Graph -->
<meta property="og:title" content="static-web — High-Performance Go Static File Server" />
<meta
property="og:description"
content="Production-grade static web file server in Go. ~148k req/sec with fasthttp — 59% faster than Bun. HTTP/2, TLS 1.2+, gzip/brotli, security hardened."
/>
<meta property="og:type" content="website" />
<meta property="og:url" content="https://static.21no.de" />
<meta property="og:site_name" content="static-web" />
<meta property="og:locale" content="en_US" />
<meta property="og:image" content="https://static.21no.de/og-image.svg" />
<meta property="og:image:type" content="image/svg+xml" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="static-web — High-Performance Go Static File Server" />
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="static-web — High-Performance Go Static File Server" />
<meta
name="twitter:description"
content="Production-grade static file server in Go. ~148k req/sec with fasthttp — 59% faster than Bun. HTTP/2, TLS, gzip/brotli — security hardened."
/>
<meta name="twitter:image" content="https://static.21no.de/og-image.svg" />
<meta name="twitter:image:alt" content="static-web — High-Performance Go Static File Server" />
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><rect width='40' height='40' rx='10' fill='%236366f1'/><path d='M12 8h10l6 6v18a2 2 0 0 1-2 2H12a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z' fill='rgba(255,255,255,0.2)' stroke='white' stroke-width='1.5'/><path d='M22 8v6h6' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/><path d='M24 19l-4 8h5l-4 8' stroke='%2322d3ee' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>"
/>
<link rel="stylesheet" href="fonts.css" />
<link rel="stylesheet" href="styles.css" />
<!-- Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "WebSite",
"name": "static-web",
"url": "https://static.21no.de",
"description": "Production-grade, high-performance static web file server written in Go.",
"publisher": {
"@type": "Organization",
"name": "21no.de",
"url": "https://21no.de"
}
},
{
"@type": "SoftwareApplication",
"name": "static-web",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Linux, macOS, Windows",
"url": "https://static.21no.de",
"downloadUrl": "https://github.com/BackendStack21/static-web/releases",
"softwareVersion": "1.2.0",
"programmingLanguage": "Go",
"license": "https://github.com/BackendStack21/static-web/blob/main/LICENSE",
"codeRepository": "https://github.com/BackendStack21/static-web",
"description": "A production-grade, blazing-fast static web file server written in Go. ~148k req/sec with fasthttp — 59% faster than Bun. Features in-memory LRU cache, TTL-aware cache expiry, HTTP/2, TLS 1.2+, gzip and brotli compression, and comprehensive security headers.",
"author": {
"@type": "Person",
"name": "Rolando Santamaria Maso",
"url": "https://21no.de"
},
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"featureList": [
"~148k req/sec — 59% faster than Bun's native static server",
"In-memory LRU cache with ~28 ns/op lookup",
"Startup preloading with path-safety cache pre-warming",
"TTL-aware cache expiry with optional automatic stale-entry eviction",
"Direct ctx.SetBody() fast path with pre-formatted headers for cache hits",
"HTTP/2 with TLS 1.2+ and HTTP→HTTPS redirect",
"TLS 1.2+ with AEAD cipher suites",
"gzip and brotli compression",
"6-step path traversal prevention",
"Security headers (CSP, HSTS, Permissions-Policy)",
"CORS with wildcard and per-origin modes",
"Directory listing with breadcrumb navigation",
"Docker and container ready",
"Graceful shutdown with signal handling"
]
},
{
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://static.21no.de"
}
]
}
]
}
</script>
</head>
<body>
<!-- Skip to content -->
<a href="#main-content" class="skip-link">Skip to content</a>
<!-- Hero Section -->
<header class="hero" id="main-content">
<canvas id="particles-canvas" aria-hidden="true"></canvas>
<nav class="nav" aria-label="Main navigation">
<div class="nav-logo">
<div class="logo-icon" aria-hidden="true">
<svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" rx="10" fill="url(#logoGrad)" />
<path
d="M12 8h10l6 6v18a2 2 0 0 1-2 2H12a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z"
fill="rgba(255,255,255,0.2)"
stroke="white"
stroke-width="1.5"
/>
<path d="M22 8v6h6" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path
d="M24 19l-4 8h5l-4 8"
stroke="#22d3ee"
stroke-width="2.2"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
/>
<defs>
<linearGradient id="logoGrad" x1="0" y1="0" x2="40" y2="40" gradientUnits="userSpaceOnUse">
<stop stop-color="#6366f1" />
<stop offset="1" stop-color="#8b5cf6" />
</linearGradient>
</defs>
</svg>
</div>
<span class="logo-text">static-web</span>
</div>
<div class="nav-links" id="nav-menu">
<a href="#features">Features</a>
<a href="#getting-started">Get Started</a>
<a href="#performance">Performance</a>
<a href="#configuration">Config</a>
<a href="https://github.com/BackendStack21/static-web" target="_blank" rel="noopener">GitHub</a>
</div>
<a
href="https://github.com/BackendStack21/static-web"
class="nav-cta"
target="_blank"
rel="noopener"
aria-label="Star on GitHub"
>
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path
d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"
/>
</svg>
Star on GitHub
</a>
<button
class="nav-hamburger"
aria-label="Toggle navigation menu"
aria-expanded="false"
aria-controls="nav-menu"
>
<span></span><span></span><span></span>
</button>
</nav>
<div class="hero-content">
<div class="hero-logo" aria-hidden="true">
<svg viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg" class="hero-logo-svg">
<rect width="80" height="80" rx="20" fill="url(#heroGrad)" />
<path
d="M24 16h20l12 12v36a4 4 0 0 1-4 4H24a4 4 0 0 1-4-4V20a4 4 0 0 1 4-4z"
fill="rgba(255,255,255,0.2)"
stroke="white"
stroke-width="2.5"
/>
<path d="M44 16v12h12" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" />
<path
d="M48 38l-8 16h10l-8 16"
stroke="#22d3ee"
stroke-width="4"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
/>
<defs>
<linearGradient id="heroGrad" x1="0" y1="0" x2="80" y2="80" gradientUnits="userSpaceOnUse">
<stop stop-color="#6366f1" />
<stop offset="0.5" stop-color="#8b5cf6" />
<stop offset="1" stop-color="#a855f7" />
</linearGradient>
</defs>
</svg>
</div>
<h1 class="hero-title">static-web</h1>
<p class="hero-subtitle">Production-Grade Go Static File Server</p>
<p class="hero-description">
Blazing fast, lightweight static server with <strong>in-memory LRU cache</strong>, startup preloading, HTTP/2, TLS, gzip / brotli,
and security headers baked in.
</p>
<div class="hero-stats">
<div class="stat">
<span class="stat-value">148k</span>
<span class="stat-label">req/sec (fasthttp)</span>
</div>
<div class="stat-divider" aria-hidden="true"></div>
<div class="stat">
<span class="stat-value">~0 alloc</span>
<span class="stat-label">hot-path serving</span>
</div>
<div class="stat-divider" aria-hidden="true"></div>
<div class="stat">
<span class="stat-value">HTTP/2</span>
<span class="stat-label">+ TLS + redirect</span>
</div>
<div class="stat-divider" aria-hidden="true"></div>
<div class="stat">
<span class="stat-value">TLS 1.2+</span>
<span class="stat-label">AEAD ciphers only</span>
</div>
</div>
<div class="hero-actions">
<a href="#getting-started" class="btn btn-primary">Get Started</a>
<a
href="https://github.com/BackendStack21/static-web"
class="btn btn-secondary"
target="_blank"
rel="noopener"
>
<svg class="btn-icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path
d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"
/>
</svg>
View on GitHub
</a>
</div>
<div class="hero-install">
<code class="install-code"
><span class="install-prefix">$</span> go install
github.com/BackendStack21/static-web/cmd/static-web@latest</code
>
<button
class="copy-btn"
data-copy="go install github.com/BackendStack21/static-web/cmd/static-web@latest"
aria-label="Copy install command"
>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
</div>
</div>
<div class="hero-glow" aria-hidden="true"></div>
</header>
<main>
<!-- Features Section -->
<section id="features" class="section-full features-bg" aria-labelledby="features-heading">
<div class="section-inner">
<h2 class="section-title" id="features-heading">Everything You Need</h2>
<p class="section-description">
Production-grade features without the bloat. Every feature is battle-tested and security-hardened.
</p>
<div class="features-grid">
<div class="feature-card">
<div class="feature-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>
</div>
<h3>Near-Zero Alloc Hot Path</h3>
<p><strong>~148k req/sec</strong> — 59% faster than Bun. Built on fasthttp with direct <code>ctx.SetBody()</code> and pre-formatted headers — no formatting allocations on cache hits.</p>
</div>
<div class="feature-card">
<div class="feature-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 22V4c0-.5.2-1 .6-1.4C5 2.2 5.5 2 6 2h8.5L20 7.5V20c0 .5-.2 1-.6 1.4-.4.4-.9.6-1.4.6h-2"/><path d="M14 2v6h6"/><path d="M10 20v-5"/><path d="M10 12v-1"/><path d="M10 8v-1"/></svg></div>
<h3>gzip + Brotli</h3>
<p>
On-the-fly gzip via pooled writers, plus pre-compressed <code>.gz</code>/<code>.br</code> sidecar file
support. Brotli preference over gzip.
</p>
</div>
<div class="feature-card">
<div class="feature-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg></div>
<h3>TLS 1.2 / 1.3</h3>
<p>
Modern cipher suites, automatic HTTP→HTTPS redirects, HSTS, and HTTP/2 via ALPN negotiation — just set
<code>tls_cert</code> and <code>tls_key</code>.
</p>
</div>
<div class="feature-card">
<div class="feature-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg></div>
<h3>Security Hardened</h3>
<p>
Path traversal prevention, dotfile blocking, CSP, HSTS, Referrer-Policy, Permissions-Policy — set on
<em>every</em> response.
</p>
</div>
<div class="feature-card">
<div class="feature-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg></div>
<h3>Smart Caching</h3>
<p>Byte-accurate LRU cache with startup preloading, configurable max size, per-file size cap, optional TTL expiry, optional ETag (disable via --no-etag), and live flush via SIGHUP without downtime.</p>
</div>
<div class="feature-card">
<div class="feature-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg></div>
<h3>HTTP/2 & Range Requests</h3>
<p>
Full HTTP/2 support, byte-range serving for video / large files, conditional requests (optional ETag via --no-etag to disable,
If-Modified-Since, 304).
</p>
</div>
<div class="feature-card">
<div class="feature-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/><path d="M2 12h20"/></svg></div>
<h3>CORS Built-In</h3>
<p>
Wildcard or per-origin CORS. Preflight returns 204 with proper headers. Wildcard emits literal
<code>*</code> — origin is never reflected.
</p>
</div>
<div class="feature-card">
<div class="feature-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2" ry="2"/><rect x="9" y="9" width="6" height="6"/><line x1="9" y1="1" x2="9" y2="4"/><line x1="15" y1="1" x2="15" y2="4"/><line x1="9" y1="20" x2="9" y2="23"/><line x1="15" y1="20" x2="15" y2="23"/><line x1="20" y1="9" x2="23" y2="9"/><line x1="20" y1="14" x2="23" y2="14"/><line x1="1" y1="9" x2="4" y2="9"/><line x1="1" y1="14" x2="4" y2="14"/></svg></div>
<h3>Container Ready</h3>
<p>
Most settings overridable via environment variables. Graceful shutdown on SIGTERM/SIGINT with
configurable drain timeout.
</p>
</div>
<div class="feature-card">
<div class="feature-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg></div>
<h3>Directory Listing</h3>
<p>
Optional HTML directory index with breadcrumb nav, sorted entries, human-readable sizes, and automatic
dotfile filtering.
</p>
</div>
</div>
</div>
</section>
<!-- Getting Started -->
<section id="getting-started" class="section-full getting-started-bg" aria-labelledby="getting-started-heading">
<div class="section-inner">
<h2 class="section-title" id="getting-started-heading">Getting Started</h2>
<p class="section-description">From zero to serving files in under 60 seconds.</p>
<div class="code-tabs">
<div class="tab-buttons" role="tablist" aria-label="Getting started examples">
<button
class="tab-btn active"
role="tab"
aria-selected="true"
aria-controls="panel-install"
id="tab-install"
>
Install
</button>
<button class="tab-btn" role="tab" aria-selected="false" aria-controls="panel-config" id="tab-config">
Config
</button>
<button class="tab-btn" role="tab" aria-selected="false" aria-controls="panel-docker" id="tab-docker">
Docker
</button>
</div>
<!-- Install Tab -->
<div class="tab-content active" id="panel-install" role="tabpanel" aria-labelledby="tab-install">
<div class="code-block">
<div class="code-header">
<span class="code-lang">Shell</span>
<button class="copy-btn" data-copy-from="code-install" aria-label="Copy shell commands">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
</div>
<pre id="code-install"><code><span class="comment"># Install via go install (requires Go 1.26+)</span>
<span class="cmd">go install</span> github.com/BackendStack21/static-web/cmd/static-web@latest
<span class="comment"># Serve current directory on :8080</span>
<span class="cmd">static-web</span> .
<span class="comment"># Production: preload + GC tuning + no-etag for max throughput</span>
<span class="cmd">static-web</span> --preload --gc-percent 400 --no-etag ./dist
<span class="comment"># Serve on port 3000 with custom index</span>
<span class="cmd">static-web</span> --port 3000 --index default.html ./dist
<span class="comment"># Disable caching entirely</span>
<span class="cmd">static-web</span> --no-cache .
<span class="comment"># Disable compression (useful for already-compressed assets)</span>
<span class="cmd">static-web</span> --no-compress ./dist
<span class="comment"># Enable directory listing</span>
<span class="cmd">static-web</span> --dir-listing ./public
<span class="comment"># Allow dotfiles</span>
<span class="cmd">static-web</span> --no-dotfile-block ./files
<span class="comment"># CORS + CSP</span>
<span class="cmd">static-web</span> --cors "https://app.example.com" --csp "default-src 'self'" ./dist
<span class="comment"># Scaffold a config file</span>
<span class="cmd">static-web</span> init
<span class="comment"># Start with a config file</span>
<span class="cmd">static-web</span> --config config.toml .</code></pre>
</div>
</div>
<!-- Config Tab -->
<div class="tab-content" id="panel-config" role="tabpanel" aria-labelledby="tab-config" hidden>
<div class="code-block">
<div class="code-header">
<span class="code-lang">TOML</span>
<button class="copy-btn" data-copy-from="code-config" aria-label="Copy TOML config">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
</div>
<pre id="code-config"><code><span class="comment"># config.toml</span>
<span class="toml-section">[server]</span>
<span class="toml-key">addr</span> = <span class="string">":80"</span>
<span class="toml-key">tls_addr</span> = <span class="string">":443"</span>
<span class="toml-key">tls_cert</span> = <span class="string">"/etc/ssl/certs/server.pem"</span>
<span class="toml-key">tls_key</span> = <span class="string">"/etc/ssl/private/server.key"</span>
<span class="toml-section">[files]</span>
<span class="toml-key">root</span> = <span class="string">"./public"</span>
<span class="toml-key">index</span> = <span class="string">"index.html"</span>
<span class="toml-key">not_found</span> = <span class="string">"404.html"</span>
<span class="toml-section">[cache]</span>
<span class="toml-key">enabled</span> = <span class="boolean">true</span>
<span class="toml-key">preload</span> = <span class="boolean">true</span> <span class="comment"># load all files at startup</span>
<span class="toml-key">max_bytes</span> = <span class="number">268435456</span> <span class="comment"># 256 MiB</span>
<span class="toml-key">max_file_size</span> = <span class="number">10485760</span> <span class="comment"># 10 MiB</span>
<span class="toml-key">gc_percent</span> = <span class="number">400</span> <span class="comment"># tune GC for throughput</span>
<span class="toml-key">ttl</span> = <span class="string">"5m"</span> <span class="comment"># optional TTL expiry</span>
<span class="toml-section">[compression]</span>
<span class="toml-key">enabled</span> = <span class="boolean">true</span>
<span class="toml-key">min_size</span> = <span class="number">1024</span>
<span class="toml-key">level</span> = <span class="number">5</span> <span class="comment"># 1=fastest, 9=best</span>
<span class="toml-key">precompressed</span> = <span class="boolean">true</span>
<span class="toml-section">[headers]</span>
<span class="toml-key">static_max_age</span> = <span class="number">3600</span> <span class="comment"># 1 hour for static assets</span>
<span class="toml-key">html_max_age</span> = <span class="number">0</span> <span class="comment"># no-cache for HTML</span>
<span class="toml-key">enable_etags</span> = <span class="boolean">false</span> <span class="comment"># disable for max throughput</span>
<span class="toml-key">immutable_pattern</span> = <span class="string">"*.chunk.js"</span> <span class="comment"># fingerprinted assets only</span>
<span class="toml-section">[security]</span>
<span class="toml-key">block_dotfiles</span> = <span class="boolean">true</span>
<span class="toml-key">directory_listing</span> = <span class="boolean">false</span>
<span class="toml-key">cors_origins</span> = [<span class="string">"https://app.example.com"</span>]
<span class="toml-key">csp</span> = <span class="string">"default-src 'self'"</span>
<span class="toml-key">referrer_policy</span> = <span class="string">"strict-origin-when-cross-origin"</span>
<span class="toml-key">permissions_policy</span> = <span class="string">"geolocation=(), microphone=(), camera=()"</span></code></pre>
</div>
</div>
<!-- Docker Tab -->
<div class="tab-content" id="panel-docker" role="tabpanel" aria-labelledby="tab-docker" hidden>
<div class="code-block">
<div class="code-header">
<span class="code-lang">Dockerfile</span>
<button class="copy-btn" data-copy-from="code-docker" aria-label="Copy Dockerfile">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
</button>
</div>
<pre id="code-docker"><code><span class="comment"># Build the binary</span>
<span class="keyword">FROM</span> golang:<span class="string">1.26-alpine</span> <span class="keyword">AS</span> builder
<span class="keyword">WORKDIR</span> /app
<span class="keyword">RUN</span> go install github.com/BackendStack21/static-web/cmd/static-web@latest
<span class="comment"># Minimal runtime image</span>
<span class="keyword">FROM</span> alpine:<span class="string">3.19</span>
<span class="keyword">COPY</span> --from=builder /root/go/bin/static-web /usr/local/bin/
<span class="keyword">COPY</span> ./public /public
<span class="comment"># Override config via env vars</span>
<span class="keyword">ENV</span> STATIC_SERVER_ADDR=<span class="string">":8080"</span>
<span class="keyword">ENV</span> STATIC_FILES_ROOT=<span class="string">"/public"</span>
<span class="keyword">ENV</span> STATIC_CACHE_ENABLED=<span class="string">"true"</span>
<span class="keyword">ENV</span> STATIC_CACHE_PRELOAD=<span class="string">"true"</span>
<span class="keyword">ENV</span> STATIC_HEADERS_ENABLE_ETAGS=<span class="string">"false"</span>
<span class="keyword">ENV</span> STATIC_COMPRESSION_ENABLED=<span class="string">"true"</span>
<span class="keyword">EXPOSE</span> 8080
<span class="keyword">CMD</span> [<span class="string">"static-web"</span>, <span class="string">"/public"</span>]</code></pre>
</div>
</div>
</div>
</div>
</section>
<!-- Architecture Section -->
<section id="architecture" class="section-full architecture-bg" aria-labelledby="architecture-heading">
<div class="section-inner">
<h2 class="section-title" id="architecture-heading">Request Pipeline</h2>
<p class="section-description">
Every request flows through a layered middleware chain — security first, cache last.
</p>
<div class="pipeline">
<div class="pipeline-step">
<div class="pipeline-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/><path d="M2 12h20"/></svg></div>
<div class="pipeline-info">
<h3>HTTP Request</h3>
<p>Incoming GET / HEAD / OPTIONS</p>
</div>
</div>
<div class="pipeline-arrow" aria-hidden="true">
<svg width="2" height="24" viewBox="0 0 2 24">
<line x1="1" y1="0" x2="1" y2="24" stroke="#3f3f46" stroke-width="2" stroke-dasharray="4 3" />
</svg>
</div>
<div class="pipeline-step">
<div class="pipeline-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg></div>
<div class="pipeline-info">
<h3>Recovery Middleware</h3>
<p>Panic → 500, log stack trace</p>
</div>
</div>
<div class="pipeline-arrow" aria-hidden="true">
<svg width="2" height="24" viewBox="0 0 2 24">
<line x1="1" y1="0" x2="1" y2="24" stroke="#3f3f46" stroke-width="2" stroke-dasharray="4 3" />
</svg>
</div>
<div class="pipeline-step">
<div class="pipeline-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg></div>
<div class="pipeline-info">
<h3>Logging Middleware</h3>
<p>Pooled status writer, method / path / status / bytes / duration</p>
</div>
</div>
<div class="pipeline-arrow" aria-hidden="true">
<svg width="2" height="24" viewBox="0 0 2 24">
<line x1="1" y1="0" x2="1" y2="24" stroke="#3f3f46" stroke-width="2" stroke-dasharray="4 3" />
</svg>
</div>
<div class="pipeline-step pipeline-step--highlight">
<div class="pipeline-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="m9 12 2 2 4-4"/></svg></div>
<div class="pipeline-info">
<h3>Security Middleware</h3>
<p>Method whitelist · security headers · path safety (cached) · dotfile block · CORS</p>
</div>
</div>
<div class="pipeline-arrow" aria-hidden="true">
<svg width="2" height="24" viewBox="0 0 2 24">
<line x1="1" y1="0" x2="1" y2="24" stroke="#3f3f46" stroke-width="2" stroke-dasharray="4 3" />
</svg>
</div>
<div class="pipeline-step">
<div class="pipeline-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 22V4c0-.5.2-1 .6-1.4C5 2.2 5.5 2 6 2h8.5L20 7.5V20c0 .5-.2 1-.6 1.4-.4.4-.9.6-1.4.6h-2"/><path d="M14 2v6h6"/><path d="M10 20v-5"/><path d="M10 12v-1"/><path d="M10 8v-1"/></svg></div>
<div class="pipeline-info">
<h3>Compress Middleware</h3>
<p>Post-processing gzip via pooled writers · content-type / size gating</p>
</div>
</div>
<div class="pipeline-arrow" aria-hidden="true">
<svg width="2" height="24" viewBox="0 0 2 24">
<line x1="1" y1="0" x2="1" y2="24" stroke="#3f3f46" stroke-width="2" stroke-dasharray="4 3" />
</svg>
</div>
<div class="pipeline-step pipeline-step--highlight">
<div class="pipeline-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg></div>
<div class="pipeline-info">
<h3>File Handler</h3>
<p>
Preloaded or cached → direct ctx.SetBody() fast path · brotli/gzip sidecar negotiation · miss → stat → read →
cache
</p>
</div>
</div>
</div>
</div>
</section>
<!-- Performance Section -->
<section id="performance" class="section-full performance-bg" aria-labelledby="performance-heading">
<div class="section-inner">
<h2 class="section-title" id="performance-heading">Performance Benchmarks</h2>
<p class="section-description">Measured on Apple M-series · localhost (no Docker) · <code>bombardier -c 100 -n 100000</code> · 3 small static files</p>
<div class="benchmark-table-wrap">
<div class="benchmark-table-inner">
<table class="benchmark-table">
<thead>
<tr>
<th>Server</th>
<th>Req/sec</th>
<th>p50 lat</th>
<th>p99 lat</th>
</tr>
</thead>
<tbody>
<tr class="highlight">
<td><span class="op-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg></span> static-web (fasthttp)</td>
<td><strong>~148,000</strong></td>
<td><strong>599 µs</strong></td>
<td><strong>2.42 ms</strong></td>
</tr>
<tr>
<td><span class="op-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="4"/></svg></span> Bun (native static)</td>
<td>~93,000</td>
<td>1.03 ms</td>
<td>2.13 ms</td>
</tr>
<tr>
<td><span class="op-icon"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg></span> static-web (old net/http)</td>
<td>~76,000</td>
<td>1.25 ms</td>
<td>3.15 ms</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="perf-cards">
<div class="perf-card">
<div class="perf-card-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z"/><path d="M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z"/></svg></div>
<h3>fasthttp + Preload</h3>
<p>
Built on <strong>fasthttp</strong> with near-zero per-request allocations. <code>--preload</code> loads all files into RAM at startup. Cache hits use direct <code>ctx.SetBody()</code> with pre-formatted headers.
</p>
</div>
<div class="perf-card">
<div class="perf-card-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/></svg></div>
<h3>59% Faster Than Bun</h3>
<p>
With fasthttp + preload, <strong>static-web reaches ~148k req/sec</strong> — <strong>59% faster than Bun at ~93k req/sec</strong>, while offering full security headers, TLS, and compression out of the box.
</p>
</div>
<div class="perf-card">
<div class="perf-card-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 12h-4l-3 9L9 3l-3 9H2"/></svg></div>
<h3>GC tuned</h3>
<p>
<code>gc_percent = 400</code> reduces GC frequency by 4x. The hot path has near-zero allocations — fasthttp reuses per-connection buffers, eliminating the per-request allocations of net/http.
</p>
</div>
</div>
</div>
</section>
<!-- Configuration Reference -->
<section id="configuration" class="section-full configuration-bg" aria-labelledby="configuration-heading">
<div class="section-inner">
<h2 class="section-title" id="configuration-heading">Configuration Reference</h2>
<p class="section-description">
All settings are optional — sensible defaults out of the box. Every TOML key has a matching env var for
containers.
</p>
<div class="config-tabs">
<div class="tab-buttons" role="tablist" aria-label="Configuration sections">
<button
class="tab-btn active"
role="tab"
aria-selected="true"
aria-controls="cfg-panel-server"
id="cfg-tab-server"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg> server
</button>
<button
class="tab-btn"
role="tab"
aria-selected="false"
aria-controls="cfg-panel-files"
id="cfg-tab-files"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg> files
</button>
<button
class="tab-btn"
role="tab"
aria-selected="false"
aria-controls="cfg-panel-cache"
id="cfg-tab-cache"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg> cache
</button>
<button
class="tab-btn"
role="tab"
aria-selected="false"
aria-controls="cfg-panel-compression"
id="cfg-tab-compression"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><path d="M4 22V4c0-.5.2-1 .6-1.4C5 2.2 5.5 2 6 2h8.5L20 7.5V20c0 .5-.2 1-.6 1.4-.4.4-.9.6-1.4.6h-2"/><path d="M14 2v6h6"/><path d="M10 20v-5"/><path d="M10 12v-1"/><path d="M10 8v-1"/></svg> compression
</button>
<button
class="tab-btn"
role="tab"
aria-selected="false"
aria-controls="cfg-panel-headers"
id="cfg-tab-headers"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg> headers
</button>
<button
class="tab-btn"
role="tab"
aria-selected="false"
aria-controls="cfg-panel-security"
id="cfg-tab-security"
>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block; vertical-align:middle; margin-right:4px;"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg> security
</button>
</div>
<!-- [server] -->
<div class="tab-content active" id="cfg-panel-server" role="tabpanel" aria-labelledby="cfg-tab-server">
<div class="config-panel">
<div class="config-table-wrapper">
<table class="config-table">
<thead>
<tr>
<th>Key</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>addr</code></td>
<td><code>:8080</code></td>
<td>HTTP listen address</td>
</tr>
<tr>
<td><code>tls_addr</code></td>
<td><code>:8443</code></td>
<td>HTTPS listen address</td>
</tr>
<tr>
<td><code>tls_cert</code></td>
<td>—</td>
<td>Path to TLS certificate (PEM)</td>
</tr>
<tr>
<td><code>tls_key</code></td>
<td>—</td>
<td>Path to TLS private key (PEM)</td>
</tr>
<tr>
<td><code>redirect_host</code></td>
<td>—</td>
<td>Canonical host for HTTP→HTTPS redirect</td>
</tr>
<tr>
<td><code>read_timeout</code></td>
<td><code>10s</code></td>
<td>Full request read deadline (Slowloris protection)</td>
</tr>
<tr>
<td><code>write_timeout</code></td>
<td><code>10s</code></td>
<td>Response write deadline</td>
</tr>
<tr>
<td><code>idle_timeout</code></td>
<td><code>75s</code></td>
<td>Keep-alive idle timeout</td>
</tr>
<tr>
<td><code>shutdown_timeout</code></td>
<td><code>15s</code></td>
<td>Graceful drain window</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- [files] -->
<div class="tab-content" id="cfg-panel-files" role="tabpanel" aria-labelledby="cfg-tab-files" hidden>
<div class="config-panel">
<div class="config-table-wrapper">
<table class="config-table">
<thead>
<tr>
<th>Key</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>root</code></td>
<td><code>./public</code></td>
<td>Directory to serve</td>
</tr>
<tr>
<td><code>index</code></td>
<td><code>index.html</code></td>
<td>Index file for directory requests</td>
</tr>
<tr>
<td><code>not_found</code></td>
<td>—</td>
<td>Custom 404 page (relative to root)</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- [cache] -->
<div class="tab-content" id="cfg-panel-cache" role="tabpanel" aria-labelledby="cfg-tab-cache" hidden>
<div class="config-panel">
<div class="config-table-wrapper">
<table class="config-table">
<thead>
<tr>
<th>Key</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>enabled</code></td>
<td><code>true</code></td>
<td>Toggle in-memory LRU cache</td>
</tr>
<tr>
<td><code>preload</code></td>
<td><code>false</code></td>
<td>Load all files into cache at startup</td>
</tr>
<tr>
<td><code>max_bytes</code></td>
<td><code>256 MiB</code></td>
<td>Cache size cap (bytes)</td>
</tr>
<tr>
<td><code>max_file_size</code></td>
<td><code>10 MiB</code></td>
<td>Max file size to cache</td>
</tr>
<tr>
<td><code>ttl</code></td>
<td><code>0</code></td>
<td>Entry TTL (0 = no expiry; flush with SIGHUP)</td>
</tr>
<tr>
<td><code>gc_percent</code></td>
<td><code>0</code></td>
<td>Go GC target % (0 = default; 400 recommended with preload)</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- [compression] -->
<div
class="tab-content"
id="cfg-panel-compression"
role="tabpanel"
aria-labelledby="cfg-tab-compression"
hidden
>
<div class="config-panel">
<div class="config-table-wrapper">
<table class="config-table">
<thead>
<tr>
<th>Key</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>enabled</code></td>
<td><code>true</code></td>
<td>Enable on-the-fly gzip compression</td>
</tr>
<tr>
<td><code>min_size</code></td>
<td><code>1024</code></td>
<td>Minimum response bytes to compress</td>
</tr>
<tr>
<td><code>level</code></td>
<td><code>5</code></td>
<td>gzip compression level (1–9)</td>
</tr>
<tr>
<td><code>precompressed</code></td>
<td><code>true</code></td>
<td>Serve .gz/.br sidecar files when available</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- [headers] -->
<div class="tab-content" id="cfg-panel-headers" role="tabpanel" aria-labelledby="cfg-tab-headers" hidden>
<div class="config-panel">
<div class="config-table-wrapper">
<table class="config-table">
<thead>
<tr>
<th>Key</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>enable_etags</code></td>
<td><code>true</code></td>
<td>Enable ETag generation and If-None-Match validation</td>
</tr>
<tr>
<td><code>immutable_pattern</code></td>
<td>—</td>
<td>Glob for immutable assets (e.g. <code>*.chunk.js</code>)</td>
</tr>
<tr>
<td><code>static_max_age</code></td>
<td><code>3600</code></td>
<td>Cache-Control max-age for non-HTML (seconds)</td>
</tr>
<tr>
<td><code>html_max_age</code></td>
<td><code>0</code></td>
<td>Cache-Control max-age for HTML (seconds)</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- [security] -->
<div class="tab-content" id="cfg-panel-security" role="tabpanel" aria-labelledby="cfg-tab-security" hidden>
<div class="config-panel">
<div class="config-table-wrapper">
<table class="config-table">
<thead>
<tr>
<th>Key</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>block_dotfiles</code></td>
<td><code>true</code></td>
<td>Block .env, .git, etc.</td>
</tr>
<tr>
<td><code>directory_listing</code></td>
<td><code>false</code></td>