{
	"admin": {
		"listen": "localhost:2019",
		"origins": [
			"localhost",
			"127.0.0.1"
		]
	},
	"logging": {
		"logs": {
			"default": {
				"encoder": {
					"format": "json"
				},
				"level": "INFO"
			}
		}
	},
	"apps": {
		"http": {
			"servers": {
				"srv0": {
					"listen": [
						":443"
					],
					"listener_wrappers": [
						{
							"routes": [
								{
									"handle": [
										{
											"handler": "proxy",
											"upstreams": [
												{
													"dial": [
														"tcp/host.docker.internal:5349"
													]
												}
											]
										}
									],
									"match": [
										{
											"tls": {
												"sni": [
													"api-abc.test.example.test.example"
												]
											}
										}
									]
								}
							],
							"wrapper": "layer4"
						},
						{
							"wrapper": "tls"
						}
					],
					"routes": [
						{
							"match": [
								{
									"host": [
										"api-abc.test.example.test.example"
									]
								}
							],
							"handle": [
								{
									"handler": "subroute",
									"routes": [
										{
											"handle": [
												{
													"handler": "static_response",
													"status_code": 421
												}
											]
										}
									]
								}
							],
							"terminal": true
						},
						{
							"match": [
								{
									"host": [
										"www.test.example"
									]
								}
							],
							"handle": [
								{
									"handler": "subroute",
									"routes": [
										{
											"handle": [
												{
													"handler": "static_response",
													"headers": {
														"Location": [
															"https://test.example{http.request.uri}"
														]
													},
													"status_code": 301
												}
											]
										}
									]
								}
							],
							"terminal": true
						},
						{
							"match": [
								{
									"host": [
										"test.example"
									]
								}
							],
							"handle": [
								{
									"handler": "subroute",
									"routes": [
										{
											"handle": [
												{
													"handler": "headers",
													"response": {
														"deferred": true,
														"delete": [
															"Server",
															"Via",
															"Alt-Svc"
														],
														"set": {
															"Referrer-Policy": [
																"no-referrer"
															],
															"Strict-Transport-Security": [
																"max-age=31536000; includeSubDomains"
															],
															"X-Content-Type-Options": [
																"nosniff"
															],
															"X-Frame-Options": [
																"DENY"
															]
														}
													}
												},
												{
													"encodings": {
														"gzip": {},
														"zstd": {}
													},
													"handler": "encode",
													"prefer": [
														"gzip",
														"zstd"
													]
												}
											]
										},
										{
											"group": "group9",
											"handle": [
												{
													"handler": "subroute",
													"routes": [
														{
															"handle": [
																{
																	"handler": "reverse_proxy",
																	"upstreams": [
																		{
																			"dial": "host.docker.internal:8920"
																		}
																	]
																}
															]
														}
													]
												}
											],
											"match": [
												{
													"path": [
														"/sfu/ws/*"
													]
												}
											]
										},
										{
											"group": "group9",
											"handle": [
												{
													"handler": "subroute",
													"routes": [
														{
															"handle": [
																{
																	"handler": "reverse_proxy",
																	"upstreams": [
																		{
																			"dial": "host.docker.internal:8912"
																		}
																	]
																}
															]
														}
													]
												}
											],
											"match": [
												{
													"path": [
														"/relay/*"
													]
												}
											]
										},
										{
											"group": "group9",
											"handle": [
												{
													"handler": "subroute",
													"routes": [
														{
															"handle": [
																{
																	"handler": "headers",
																	"response": {
																		"set": {
																			"Cache-Control": [
																				"public, max-age=31536000, immutable"
																			]
																		}
																	}
																}
															],
															"match": [
																{
																	"path_regexp": {
																		"name": "immutable",
																		"pattern": "/_app/immutable/.*"
																	}
																}
															]
														},
														{
															"handle": [
																{
																	"handler": "reverse_proxy",
																	"headers": {
																		"request": {
																			"set": {
																				"Host": [
																					"oxpulse.chat"
																				],
																				"X-Channel-Tag": [
																					"{http.reverse_proxy.upstream.hostport}"
																				],
																				"X-Forwarded-Host": [
																					"test.example"
																				],
																				"X-Forwarded-Proto": [
																					"https"
																				],
																				"X-Geo-Country": [
																					"{http.vars.maxmind_country_code}"
																				]
																			}
																		}
																	},
																	"health_checks": {
																		"active": {
																			"expect_status": 2,
																			"fails": 3,
																			"interval": 10000000000,
																			"passes": 2,
																			"timeout": 3000000000,
																			"uri": "/api/health"
																		}
																	},
																	"load_balancing": {
																		"selection_policy": {
																			"policy": "first"
																		},
																		"try_duration": 5000000000,
																		"try_interval": 250000000
																	},
																	"upstreams": [
																		{
																			"dial": "10.9.0.2:8907"
																		},
																		{
																			"dial": "xray-client:3080"
																		},
																		{
																			"dial": "host.docker.internal:18443"
																		},
																		{
																			"dial": "127.0.0.1:{{NAIVE_SOCKS_PORT}}"
																		}
																	]
																}
															],
															"match": [
																{
																	"path": [
																		"/events/*"
																	]
																}
															]
														},
														{
															"handle": [
																{
																	"handler": "reverse_proxy",
																	"headers": {
																		"request": {
																			"set": {
																				"Host": [
																					"oxpulse.chat"
																				],
																				"X-Channel-Tag": [
																					"{http.reverse_proxy.upstream.hostport}"
																				],
																				"X-Forwarded-Host": [
																					"test.example"
																				],
																				"X-Forwarded-Proto": [
																					"https"
																				],
																				"X-Geo-Country": [
																					"{http.vars.maxmind_country_code}"
																				]
																			}
																		}
																	},
																	"health_checks": {
																		"active": {
																			"expect_status": 2,
																			"fails": 3,
																			"interval": 10000000000,
																			"passes": 2,
																			"timeout": 3000000000,
																			"uri": "/api/health"
																		}
																	},
																	"load_balancing": {
																		"selection_policy": {
																			"policy": "first"
																		},
																		"try_duration": 5000000000,
																		"try_interval": 250000000
																	},
																	"upstreams": [
																		{
																			"dial": "10.9.0.2:8907"
																		},
																		{
																			"dial": "xray-client:3080"
																		},
																		{
																			"dial": "host.docker.internal:18443"
																		},
																		{
																			"dial": "127.0.0.1:{{NAIVE_SOCKS_PORT}}"
																		}
																	]
																}
															],
															"match": [
																{
																	"path": [
																		"/api/*"
																	]
																}
															]
														},
														{
															"handle": [
																{
																	"handler": "reverse_proxy",
																	"headers": {
																		"request": {
																			"set": {
																				"Host": [
																					"oxpulse.chat"
																				],
																				"X-Channel-Tag": [
																					"{http.reverse_proxy.upstream.hostport}"
																				],
																				"X-Forwarded-Host": [
																					"test.example"
																				],
																				"X-Forwarded-Proto": [
																					"https"
																				],
																				"X-Geo-Country": [
																					"{http.vars.maxmind_country_code}"
																				]
																			}
																		}
																	},
																	"health_checks": {
																		"active": {
																			"expect_status": 2,
																			"fails": 3,
																			"interval": 10000000000,
																			"passes": 2,
																			"timeout": 3000000000,
																			"uri": "/api/health"
																		}
																	},
																	"load_balancing": {
																		"selection_policy": {
																			"policy": "first"
																		},
																		"try_duration": 5000000000,
																		"try_interval": 250000000
																	},
																	"upstreams": [
																		{
																			"dial": "10.9.0.2:8907"
																		},
																		{
																			"dial": "xray-client:3080"
																		},
																		{
																			"dial": "host.docker.internal:18443"
																		},
																		{
																			"dial": "127.0.0.1:{{NAIVE_SOCKS_PORT}}"
																		}
																	]
																}
															],
															"match": [
																{
																	"path": [
																		"/ws/*"
																	]
																}
															]
														},
														{
															"handle": [
																{
																	"handler": "reverse_proxy",
																	"headers": {
																		"request": {
																			"set": {
																				"Host": [
																					"oxpulse.chat"
																				],
																				"X-Channel-Tag": [
																					"{http.reverse_proxy.upstream.hostport}"
																				],
																				"X-Forwarded-Host": [
																					"test.example"
																				],
																				"X-Forwarded-Proto": [
																					"https"
																				],
																				"X-Geo-Country": [
																					"{http.vars.maxmind_country_code}"
																				]
																			}
																		}
																	},
																	"health_checks": {
																		"active": {
																			"expect_status": 2,
																			"fails": 3,
																			"interval": 10000000000,
																			"passes": 2,
																			"timeout": 3000000000,
																			"uri": "/api/health"
																		}
																	},
																	"load_balancing": {
																		"selection_policy": {
																			"policy": "first"
																		},
																		"try_duration": 5000000000,
																		"try_interval": 250000000
																	},
																	"upstreams": [
																		{
																			"dial": "10.9.0.2:8907"
																		},
																		{
																			"dial": "xray-client:3080"
																		},
																		{
																			"dial": "host.docker.internal:18443"
																		},
																		{
																			"dial": "127.0.0.1:{{NAIVE_SOCKS_PORT}}"
																		}
																	]
																}
															]
														}
													]
												}
											]
										}
									]
								}
							],
							"terminal": true
						}
					],
					"protocols": [
						"h1",
						"h2"
					]
				},
				"srv1": {
					"listen": [
						":80"
					],
					"listener_wrappers": [
						{
							"routes": [
								{
									"handle": [
										{
											"handler": "proxy",
											"upstreams": [
												{
													"dial": [
														"tcp/host.docker.internal:5349"
													]
												}
											]
										}
									],
									"match": [
										{
											"tls": {
												"sni": [
													"api-abc.test.example.test.example"
												]
											}
										}
									]
								}
							],
							"wrapper": "layer4"
						},
						{
							"wrapper": "tls"
						}
					],
					"routes": [
						{
							"match": [
								{
									"host": [
										"www.test.example"
									]
								}
							],
							"handle": [
								{
									"handler": "subroute",
									"routes": [
										{
											"handle": [
												{
													"handler": "static_response",
													"headers": {
														"Location": [
															"https://test.example{http.request.uri}"
														]
													},
													"status_code": 301
												}
											]
										}
									]
								}
							],
							"terminal": true
						}
					],
					"protocols": [
						"h1",
						"h2"
					]
				},
				"srv2": {
					"listen": [
						":9080"
					],
					"listener_wrappers": [
						{
							"routes": [
								{
									"handle": [
										{
											"handler": "proxy",
											"upstreams": [
												{
													"dial": [
														"tcp/host.docker.internal:5349"
													]
												}
											]
										}
									],
									"match": [
										{
											"tls": {
												"sni": [
													"api-abc.test.example.test.example"
												]
											}
										}
									]
								}
							],
							"wrapper": "layer4"
						},
						{
							"wrapper": "tls"
						}
					],
					"routes": [
						{
							"match": [
								{
									"host": [
										"127.0.0.1"
									]
								}
							],
							"handle": [
								{
									"handler": "subroute",
									"routes": [
										{
											"group": "group12",
											"handle": [
												{
													"handler": "subroute",
													"routes": [
														{
															"handle": [
																{
																	"body": "__CADDYFILE_SHA__",
																	"handler": "static_response",
																	"status_code": 200
																}
															]
														}
													]
												}
											],
											"match": [
												{
													"path": [
														"/canary/config-hash"
													]
												}
											]
										},
										{
											"group": "group12",
											"handle": [
												{
													"handler": "subroute",
													"routes": [
														{
															"handle": [
																{
																	"body": "{\"routes\":[\"tunnel\",\"sfu\",\"relay\",\"branding\"]}",
																	"handler": "static_response",
																	"status_code": 200
																}
															]
														}
													]
												}
											],
											"match": [
												{
													"path": [
														"/canary/route-table"
													]
												}
											]
										},
										{
											"group": "group12",
											"handle": [
												{
													"handler": "subroute",
													"routes": [
														{
															"handle": [
																{
																	"handler": "reverse_proxy",
																	"transport": {
																		"dial_timeout": 2000000000,
																		"protocol": "http",
																		"response_header_timeout": 2000000000
																	},
																	"upstreams": [
																		{
																			"dial": "xray-client:3080"
																		}
																	]
																}
															]
														}
													]
												}
											],
											"match": [
												{
													"path": [
														"/canary/upstream"
													]
												}
											]
										},
										{
											"group": "group12",
											"handle": [
												{
													"handler": "subroute",
													"routes": [
														{
															"handle": [
																{
																	"handler": "reverse_proxy",
																	"transport": {
																		"dial_timeout": 2000000000,
																		"protocol": "http",
																		"response_header_timeout": 2000000000
																	},
																	"upstreams": [
																		{
																			"dial": "xray-client:3080/health:80"
																		}
																	]
																}
															]
														}
													]
												}
											],
											"match": [
												{
													"path": [
														"/canary/tunnel"
													]
												}
											]
										}
									]
								}
							],
							"terminal": true
						}
					],
					"automatic_https": {
						"skip": [
							"127.0.0.1"
						]
					},
					"protocols": [
						"h1",
						"h2"
					]
				}
			},
			"metrics": {}
		},
		"tls": {
			"automation": {
				"policies": [
					{
						"subjects": [
							"api-abc.test.example.test.example"
						],
						"issuers": [
							{
								"challenges": {
									"tls-alpn": {
										"disabled": true
									}
								},
								"email": "admin@test.example",
								"module": "acme"
							}
						]
					},
					{
						"subjects": [
							"www.test.example",
							"test.example"
						],
						"issuers": [
							{
								"email": "admin@test.example",
								"module": "acme"
							},
							{
								"ca": "https://acme.zerossl.com/v2/DV90",
								"email": "admin@test.example",
								"module": "acme"
							}
						]
					}
				]
			}
		}
	}
}
