File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export const ProxyType = type({
77 tls : 'string' ,
88 source : 'string' ,
99 base : 'string' ,
10+ health_check : 'boolean' ,
1011} )
1112
1213const CaddyContext = type ( {
@@ -48,19 +49,14 @@ export const caddyTemplate = `{
4849{% for p in proxies %}
4950{{ p.target }}{{ p.port_suffix }} {
5051 {{ p.tls }}
51- reverse_proxy http://{{ p.source }} {
52+ reverse_proxy http://{{ p.source }} {% if p.health_check %} {
5253 health_uri {{ p.base }}
5354 health_interval 2s
5455 health_timeout 5s
5556 fail_duration 2s
5657 unhealthy_status 502 503 504 404
5758 lb_try_duration 3s
5859 lb_try_interval 300ms
59- health_headers {
60- Accept text/html
61- Accept-Encoding gzip, deflate, br
62- User-Agent Caddy-Health-Check
63- }
6460
6561 @error status 502 503 504 404
6662 handle_response @error {
@@ -70,6 +66,7 @@ export const caddyTemplate = `{
7066 }
7167 }
7268 }
69+ {% endif %}
7370}
7471{% endfor %}
7572`
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ interface RunOptions {
102102 base : string
103103 showCaddyLog : boolean
104104 https : boolean
105+ health_check ?: boolean
105106}
106107
107108const { cleanUp, configJsonRef, writeCaddyConfig } = useCaddyConfig ( )
@@ -177,6 +178,7 @@ export class CaddyInstant {
177178 base = '/' ,
178179 showCaddyLog = false ,
179180 https = false ,
181+ health_check = true ,
180182 } = options || { }
181183
182184 this . _source = source
@@ -198,6 +200,7 @@ export class CaddyInstant {
198200 tls : https ? 'tls internal' : '' ,
199201 source,
200202 base,
203+ health_check,
201204 } ,
202205 ]
203206
Original file line number Diff line number Diff line change @@ -5,4 +5,5 @@ export interface Options {
55 showCaddyLog ?: boolean
66 /** default `false` */
77 https ?: boolean
8+ health_check ?: boolean
89}
You can’t perform that action at this time.
0 commit comments