~cytrogen/realm

ref: 4691e5f5dcf3fab174c95a5e5cd6414a05bdd329 realm/caddy/phase1-redirect.example.Caddyfile -rw-r--r-- 1.5 KiB
4691e5f5 — Cytrogen Initialize Realm: Phase 1 redirect + Phase 2 design system a month ago
                                                                                
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
# Phase 1: Blog migration — cytrogen.icu → blog.cytrogen.icu
#
# This is a reference copy of the redirect blocks deployed to /etc/caddy/Caddyfile.
# The production Caddyfile also includes blocks for sourcehut, beszel, freshrss,
# stalwart, etc. — only the realm-relevant portions are shown here.
#
# Status: DEPLOYED 2026-02-27

# Blog now served from /var/www/blog.cytrogen.icu
blog.cytrogen.icu {
	root * /var/www/blog.cytrogen.icu
	file_server
	encode gzip

	@static path *.css *.js *.jpg *.jpeg *.png *.gif *.ico *.svg *.webp *.woff *.woff2 *.ttf *.eot
	header @static Cache-Control "public, max-age=2592000, immutable"

	@html path *.html
	header @html Cache-Control "public, max-age=3600, must-revalidate"

	handle_errors {
		@4xx expression `{err.status_code} >= 400 && {err.status_code} < 500`
		handle @4xx {
			rewrite * /{err.status_code}.html
			file_server
		}
		@5xx expression `{err.status_code} >= 500`
		handle @5xx {
			rewrite * /{err.status_code}.html
			file_server
		}
	}

	try_files {path} {path}/ {path}.html
}

# 301 permanent redirect — root domain to blog subdomain
cytrogen.icu, www.cytrogen.icu {
	header Link `<https://blog.cytrogen.icu{uri}>; rel="canonical"`
	header X-Robots-Tag "noindex, nofollow"
	redir https://blog.cytrogen.icu{uri} permanent
}

# Phase 4: Replace the redirect block above with:
#
# cytrogen.icu, www.cytrogen.icu {
#     root * /var/www/realm
#     file_server
#     encode gzip
#     try_files {path} {path}/ {path}.html
# }