2017-12-23 16:45:51 +00:00
|
|
|
[backends]
|
|
|
|
{{range $backend := List .Prefix "/backends/"}}
|
|
|
|
{{$backendName := Last $backend}}
|
|
|
|
|
|
|
|
{{$circuitBreaker := Get "" $backend "/circuitbreaker/expression"}}
|
|
|
|
{{with $circuitBreaker}}
|
|
|
|
[backends."{{$backendName}}".circuitBreaker]
|
2015-09-25 09:44:19 +00:00
|
|
|
expression = "{{$circuitBreaker}}"
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}
|
2015-09-25 09:44:19 +00:00
|
|
|
|
2017-12-23 16:45:51 +00:00
|
|
|
{{$loadBalancer := Get "" $backend "/loadbalancer/method"}}
|
|
|
|
{{with $loadBalancer}}
|
|
|
|
[backends."{{$backendName}}".loadBalancer]
|
2015-09-25 09:44:19 +00:00
|
|
|
method = "{{$loadBalancer}}"
|
2017-12-23 16:45:51 +00:00
|
|
|
sticky = {{ getSticky $backend }}
|
2017-10-10 09:10:02 +00:00
|
|
|
{{if hasStickinessLabel $backend}}
|
2017-10-16 15:38:03 +00:00
|
|
|
[backends."{{$backendName}}".loadBalancer.stickiness]
|
2017-12-19 13:08:03 +00:00
|
|
|
cookieName = "{{getStickinessCookieName $backend}}"
|
2017-10-10 09:10:02 +00:00
|
|
|
{{end}}
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}
|
2015-09-25 09:44:19 +00:00
|
|
|
|
2017-12-23 16:45:51 +00:00
|
|
|
{{$maxConnAmt := Get "" $backend "/maxconn/amount"}}
|
|
|
|
{{$maxConnExtractorFunc := Get "" $backend "/maxconn/extractorfunc"}}
|
|
|
|
{{with $maxConnAmt}}
|
|
|
|
{{with $maxConnExtractorFunc}}
|
|
|
|
[backends."{{$backendName}}".maxConn]
|
2016-04-13 08:11:36 +00:00
|
|
|
amount = {{$maxConnAmt}}
|
|
|
|
extractorFunc = "{{$maxConnExtractorFunc}}"
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{$healthCheck := Get "" $backend "/healthcheck/path"}}
|
|
|
|
{{with $healthCheck}}
|
|
|
|
[backends."{{$backendName}}".healthCheck]
|
|
|
|
path = "{{$healthCheck}}"
|
2018-01-03 15:29:58 +00:00
|
|
|
port = {{ Get "0" $backend "/healthcheck/port" }}
|
2017-12-23 16:45:51 +00:00
|
|
|
interval = "{{ Get "30s" $backend "/healthcheck/interval" }}"
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{range $server := ListServers $backend}}
|
|
|
|
[backends."{{$backendName}}".servers."{{Last $server}}"]
|
|
|
|
url = "{{Get "" $server "/url"}}"
|
|
|
|
weight = {{Get "0" $server "/weight"}}
|
|
|
|
{{end}}
|
2016-04-13 08:11:36 +00:00
|
|
|
|
2015-09-21 16:05:56 +00:00
|
|
|
{{end}}
|
|
|
|
|
2017-12-23 16:45:51 +00:00
|
|
|
[frontends]
|
|
|
|
{{range $frontend := List .Prefix "/frontends/" }}
|
|
|
|
{{$frontendName := Last $frontend}}
|
|
|
|
|
|
|
|
[frontends."{{$frontendName}}"]
|
|
|
|
backend = "{{Get "" $frontend "/backend"}}"
|
|
|
|
priority = {{Get "0" $frontend "/priority"}}
|
|
|
|
passHostHeader = {{Get "true" $frontend "/passHostHeader"}}
|
2018-01-03 15:29:28 +00:00
|
|
|
passTLSCert = {{Get "false" $frontend "/passtlscert"}}
|
2017-12-23 16:45:51 +00:00
|
|
|
|
|
|
|
{{$entryPoints := SplitGet $frontend "/entrypoints"}}
|
2016-02-01 15:08:58 +00:00
|
|
|
entryPoints = [{{range $entryPoints}}
|
|
|
|
"{{.}}",
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}]
|
|
|
|
|
2018-01-03 15:30:37 +00:00
|
|
|
{{$whitelistSourceRange := SplitGet $frontend "/whitelistsourcerange"}}
|
|
|
|
whitelistSourceRange = [{{range $whitelistSourceRange}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
|
2018-01-03 15:32:11 +00:00
|
|
|
{{$basicAuth := SplitGet $frontend "/basicauth"}}
|
|
|
|
basicAuth = [{{range $basicAuth}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
|
2018-01-03 15:37:31 +00:00
|
|
|
{{$redirect := getRedirect $frontend }}
|
|
|
|
{{ if $redirect }}
|
|
|
|
[frontends."{{$frontendName}}".redirect]
|
|
|
|
entryPoint = "{{ $redirect.EntryPoint }}"
|
|
|
|
regex = "{{ $redirect.Regex }}"
|
|
|
|
replacement = "{{ $redirect.Replacement }}"
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-03 15:39:37 +00:00
|
|
|
{{ $errorPages := getErrorPages $frontend }}
|
|
|
|
{{ if $errorPages }}
|
|
|
|
[frontends."{{$frontendName}}".errors]
|
|
|
|
{{ range $pageName, $page := $errorPages }}
|
|
|
|
[frontends."{{$frontendName}}".errors.{{ $pageName }}]
|
|
|
|
status = [{{range $page.Status}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
backend = "{{$page.Backend}}"
|
|
|
|
query = "{{$page.Query}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-03 15:42:40 +00:00
|
|
|
{{ $rateLimit := getRateLimit $frontend }}
|
|
|
|
{{ if $rateLimit }}
|
|
|
|
[frontends."{{$frontendName}}".rateLimit]
|
|
|
|
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
|
|
|
|
[frontends."{{$frontendName}}".rateLimit.rateSet]
|
|
|
|
{{ range $limitName, $rateLimit := $rateLimit.RateSet }}
|
|
|
|
[frontends."{{$frontendName}}".rateLimit.rateSet.{{ $limitName }}]
|
|
|
|
period = "{{ $rateLimit.Period }}"
|
|
|
|
average = {{ $rateLimit.Average }}
|
|
|
|
burst = {{ $rateLimit.Burst }}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-03 15:49:13 +00:00
|
|
|
{{ $headers := getHeaders $frontend }}
|
|
|
|
{{ if $headers }}
|
|
|
|
[frontends."{{ $frontendName }}".headers]
|
|
|
|
SSLRedirect = {{ $headers.SSLRedirect }}
|
|
|
|
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
|
|
|
|
SSLHost = "{{ $headers.SSLHost }}"
|
|
|
|
STSSeconds = {{ $headers.STSSeconds }}
|
|
|
|
STSIncludeSubdomains = {{ $headers.STSIncludeSubdomains }}
|
|
|
|
STSPreload = {{ $headers.STSPreload }}
|
|
|
|
ForceSTSHeader = {{ $headers.ForceSTSHeader }}
|
|
|
|
FrameDeny = {{ $headers.FrameDeny }}
|
|
|
|
CustomFrameOptionsValue = "{{ $headers.CustomFrameOptionsValue }}"
|
|
|
|
ContentTypeNosniff = {{ $headers.ContentTypeNosniff }}
|
|
|
|
BrowserXSSFilter = {{ $headers.BrowserXSSFilter }}
|
|
|
|
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
|
|
|
|
PublicKey = "{{ $headers.PublicKey }}"
|
|
|
|
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
|
|
|
|
IsDevelopment = {{ $headers.IsDevelopment }}
|
|
|
|
|
|
|
|
{{ if $headers.AllowedHosts }}
|
|
|
|
AllowedHosts = [{{ range $headers.AllowedHosts }}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{ if $headers.HostsProxyHeaders }}
|
|
|
|
HostsProxyHeaders = [{{ range $headers.HostsProxyHeaders }}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{ if $headers.CustomRequestHeaders }}
|
|
|
|
[frontends."{{ $frontendName }}".headers.customRequestHeaders]
|
|
|
|
{{ range $k, $v := $headers.CustomRequestHeaders }}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{ if $headers.CustomResponseHeaders }}
|
|
|
|
[frontends."{{ $frontendName }}".headers.customResponseHeaders]
|
|
|
|
{{ range $k, $v := $headers.CustomResponseHeaders }}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{ if $headers.SSLProxyHeaders }}
|
|
|
|
[frontends."{{ $frontendName }}".headers.SSLProxyHeaders]
|
|
|
|
{{range $k, $v := $headers.SSLProxyHeaders}}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2017-12-23 16:45:51 +00:00
|
|
|
{{range $route := List $frontend "/routes/"}}
|
|
|
|
[frontends."{{$frontendName}}".routes."{{Last $route}}"]
|
|
|
|
rule = "{{Get "" $route "/rule"}}"
|
|
|
|
{{end}}
|
|
|
|
|
2015-09-25 09:44:19 +00:00
|
|
|
{{end}}
|
2017-11-23 10:50:03 +00:00
|
|
|
|
2017-12-23 16:45:51 +00:00
|
|
|
{{range $tlsConfiguration := List .Prefix "/tlsconfiguration/"}}
|
|
|
|
|
2017-11-23 10:50:03 +00:00
|
|
|
[[tlsConfiguration]]
|
2017-12-23 16:45:51 +00:00
|
|
|
|
|
|
|
{{$entryPoints := SplitGet $tlsConfiguration "/entrypoints"}}
|
|
|
|
entryPoints = [{{range $entryPoints}}
|
|
|
|
"{{.}}",
|
2017-11-23 10:50:03 +00:00
|
|
|
{{end}}]
|
|
|
|
|
2017-12-23 16:45:51 +00:00
|
|
|
[tlsConfiguration.certificate]
|
|
|
|
certFile = """{{Get "" $tlsConfiguration "/certificate/certfile"}}"""
|
|
|
|
keyFile = """{{Get "" $tlsConfiguration "/certificate/keyfile"}}"""
|
|
|
|
|
|
|
|
{{end}}
|