all repos — flynet @ bc5972f253deceddd2580d8f80ddff3a720cc2dd

ersatz CDN on fly.io

Caddyfile (view raw)

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
{
  admin off
  persist_config off

	http_port "{$SERVER_PORT:80}"
	https_port "{$SERVER_TLS_PORT:443}"

	servers {
		protocols h1 h2
	}

	cache {
		ttl 1h
		simplefs {
			path /data/
			# size 100000
			# directory_size 1000MB
		}
	}
	log {
		format console
	}

	acme_ca https://acme-api.actalis.com/acme/directory
	acme_eab {
		key_id {$EAB_KEY_ID}
		mac_key {$EAB_MAC_KEY}
	}

	storage redis {
		host redis.alin.ovh
		username default
		db 1
		password {$REDIS_PASSWORD}
		encryption_key {$REDIS_ENCRYPTION_KEY}
		tls_enabled true
		tls_insecure false
	}
}

(dns01) {
	tls {
		dns rfc2136 {
			key_name caddy
			key_alg hmac-sha512
			key {env.DDNS_TSIG_KEY}
			server pdns.alin.ovh:53
		}
	}
}

(cache) {
	cache
	header -Server
}

flynet-butterfly-1123.fly.dev {
	respond "Hello, world!"
}

alanpearce.eu, alin.ovh, www.alanpearce.eu, www.alin.ovh {
	import cache
	import dns01
	reverse_proxy https://homestead-homestead488.danubedata.run {
	  header_up Host {hostport}
	}
}

go.alin.ovh {
	import cache
	import dns01
	reverse_proxy https://smrk.alin.ovh {
	  header_up Host {hostport}
	}
}

searchix.ovh {
  import cache
  import dns01
  reverse_proxy {
    to https://smrk.alin.ovh
    lb_policy first

    header_up Host {hostport}

    # active health checks (service running)
    health_uri /health
    health_status 2xx
    health_interval 10s
    health_timeout 2s
    health_fails 2

    # passive health checks
    max_fails 5
    fail_duration 30s
    unhealthy_status 5xx
  }
}