2017-12-23 16:45:51 +00:00
|
|
|
[backends]
|
2018-01-05 16:31:24 +00:00
|
|
|
{{range $backend := List .Prefix "/backends/" }}
|
|
|
|
{{ $backendName := Last $backend }}
|
2017-12-23 16:45:51 +00:00
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{ $circuitBreaker := getCircuitBreaker $backend }}
|
|
|
|
{{if $circuitBreaker }}
|
|
|
|
[backends."{{ $backendName }}".circuitBreaker]
|
|
|
|
expression = "{{ $circuitBreaker.Expression }}"
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}
|
2015-09-25 09:44:19 +00:00
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{ $loadBalancer := getLoadBalancer $backend }}
|
|
|
|
{{if $loadBalancer }}
|
|
|
|
[backends."{{ $backendName }}".loadBalancer]
|
|
|
|
method = "{{ $loadBalancer.Method }}"
|
|
|
|
sticky = {{ $loadBalancer.Sticky }}
|
|
|
|
{{if $loadBalancer.Stickiness }}
|
|
|
|
[backends."{{ $backendName }}".loadBalancer.stickiness]
|
|
|
|
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
|
|
|
|
{{end}}
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}
|
2015-09-25 09:44:19 +00:00
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{ $maxConn := getMaxConn $backend }}
|
|
|
|
{{if $maxConn }}
|
|
|
|
[backends."{{ $backendName }}".maxConn]
|
|
|
|
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
|
|
|
|
amount = {{ $maxConn.Amount }}
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{ $healthCheck := getHealthCheck $backend }}
|
|
|
|
{{if $healthCheck }}
|
|
|
|
[backends.{{ $backendName }}.healthCheck]
|
|
|
|
path = "{{ $healthCheck.Path }}"
|
|
|
|
port = {{ $healthCheck.Port }}
|
|
|
|
interval = "{{ $healthCheck.Interval }}"
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}
|
|
|
|
|
2018-01-31 14:32:04 +00:00
|
|
|
{{ $buffering := getBuffering $backend }}
|
|
|
|
{{if $buffering }}
|
|
|
|
[backends.{{ $backendName }}.buffering]
|
|
|
|
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
|
|
|
|
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
|
|
|
|
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
|
|
|
|
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
|
|
|
|
retryExpression = "{{ $buffering.RetryExpression }}"
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{range $serverName, $server := getServers $backend}}
|
|
|
|
[backends."{{ $backendName }}".servers."{{ $serverName }}"]
|
|
|
|
url = "{{ $server.URL }}"
|
|
|
|
weight = {{ $server.Weight }}
|
2017-12-23 16:45:51 +00:00
|
|
|
{{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/" }}
|
2018-01-05 16:31:24 +00:00
|
|
|
{{ $frontendName := Last $frontend }}
|
2017-12-23 16:45:51 +00:00
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
[frontends."{{ $frontendName }}"]
|
|
|
|
backend = "{{ getBackendName $frontend }}"
|
|
|
|
priority = {{ getPriority $frontend }}
|
|
|
|
passHostHeader = {{ getPassHostHeader $frontend }}
|
|
|
|
passTLSCert = {{ getPassTLSCert $frontend }}
|
2017-12-23 16:45:51 +00:00
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
entryPoints = [{{range getEntryPoints $frontend }}
|
2016-02-01 15:08:58 +00:00
|
|
|
"{{.}}",
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}]
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
basicAuth = [{{range getBasicAuth $frontend }}
|
2018-01-03 15:32:11 +00:00
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
|
2018-03-23 16:40:04 +00:00
|
|
|
{{ $whitelist := getWhiteList $frontend }}
|
|
|
|
{{if $whitelist }}
|
|
|
|
[frontends."{{ $frontendName }}".whiteList]
|
|
|
|
sourceRange = [{{range $whitelist.SourceRange }}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
useXForwardedFor = {{ $whitelist.UseXForwardedFor }}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{ $redirect := getRedirect $frontend }}
|
|
|
|
{{if $redirect }}
|
|
|
|
[frontends."{{ $frontendName }}".redirect]
|
2018-01-03 15:37:31 +00:00
|
|
|
entryPoint = "{{ $redirect.EntryPoint }}"
|
|
|
|
regex = "{{ $redirect.Regex }}"
|
|
|
|
replacement = "{{ $redirect.Replacement }}"
|
2018-01-31 18:10:04 +00:00
|
|
|
permanent = {{ $redirect.Permanent }}
|
2018-01-03 15:37:31 +00:00
|
|
|
{{end}}
|
|
|
|
|
2018-01-03 15:39:37 +00:00
|
|
|
{{ $errorPages := getErrorPages $frontend }}
|
2018-01-05 16:31:24 +00:00
|
|
|
{{if $errorPages }}
|
|
|
|
[frontends."{{ $frontendName }}".errors]
|
|
|
|
{{range $pageName, $page := $errorPages }}
|
2018-03-07 21:10:04 +00:00
|
|
|
[frontends."{{$frontendName}}".errors."{{ $pageName }}"]
|
2018-01-05 16:31:24 +00:00
|
|
|
status = [{{range $page.Status }}
|
2018-01-03 15:39:37 +00:00
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
backend = "{{$page.Backend}}"
|
|
|
|
query = "{{$page.Query}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-03 15:42:40 +00:00
|
|
|
{{ $rateLimit := getRateLimit $frontend }}
|
2018-01-05 16:31:24 +00:00
|
|
|
{{if $rateLimit }}
|
|
|
|
[frontends."{{ $frontendName }}".rateLimit]
|
2018-01-03 15:42:40 +00:00
|
|
|
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
|
2018-01-05 16:31:24 +00:00
|
|
|
[frontends."{{ $frontendName }}".rateLimit.rateSet]
|
|
|
|
{{range $limitName, $rateLimit := $rateLimit.RateSet }}
|
2018-03-07 21:10:04 +00:00
|
|
|
[frontends."{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
|
2018-01-03 15:42:40 +00:00
|
|
|
period = "{{ $rateLimit.Period }}"
|
|
|
|
average = {{ $rateLimit.Average }}
|
|
|
|
burst = {{ $rateLimit.Burst }}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-03 15:49:13 +00:00
|
|
|
{{ $headers := getHeaders $frontend }}
|
2018-01-05 16:31:24 +00:00
|
|
|
{{if $headers }}
|
2018-01-03 15:49:13 +00:00
|
|
|
[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 }}
|
2018-03-02 13:24:03 +00:00
|
|
|
CustomBrowserXSSValue = "{{ $headers.CustomBrowserXSSValue }}"
|
2018-01-03 15:49:13 +00:00
|
|
|
ContentSecurityPolicy = "{{ $headers.ContentSecurityPolicy }}"
|
|
|
|
PublicKey = "{{ $headers.PublicKey }}"
|
|
|
|
ReferrerPolicy = "{{ $headers.ReferrerPolicy }}"
|
|
|
|
IsDevelopment = {{ $headers.IsDevelopment }}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{if $headers.AllowedHosts }}
|
|
|
|
AllowedHosts = [{{range $headers.AllowedHosts }}
|
2018-01-03 15:49:13 +00:00
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{if $headers.HostsProxyHeaders }}
|
|
|
|
HostsProxyHeaders = [{{range $headers.HostsProxyHeaders }}
|
2018-01-03 15:49:13 +00:00
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{if $headers.CustomRequestHeaders }}
|
2018-01-03 15:49:13 +00:00
|
|
|
[frontends."{{ $frontendName }}".headers.customRequestHeaders]
|
2018-01-05 16:31:24 +00:00
|
|
|
{{range $k, $v := $headers.CustomRequestHeaders }}
|
2018-01-03 15:49:13 +00:00
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{if $headers.CustomResponseHeaders }}
|
2018-01-03 15:49:13 +00:00
|
|
|
[frontends."{{ $frontendName }}".headers.customResponseHeaders]
|
2018-01-05 16:31:24 +00:00
|
|
|
{{range $k, $v := $headers.CustomResponseHeaders }}
|
2018-01-03 15:49:13 +00:00
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{if $headers.SSLProxyHeaders }}
|
2018-01-03 15:49:13 +00:00
|
|
|
[frontends."{{ $frontendName }}".headers.SSLProxyHeaders]
|
|
|
|
{{range $k, $v := $headers.SSLProxyHeaders}}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-05 16:31:24 +00:00
|
|
|
{{range $routeName, $route := getRoutes $frontend }}
|
|
|
|
[frontends."{{ $frontendName }}".routes."{{ $routeName }}"]
|
|
|
|
rule = "{{ $route.Rule }}"
|
2017-12-23 16:45:51 +00:00
|
|
|
{{end}}
|
|
|
|
|
2015-09-25 09:44:19 +00:00
|
|
|
{{end}}
|
2017-11-23 10:50:03 +00:00
|
|
|
|
2018-01-24 10:57:06 +00:00
|
|
|
{{range $tls := getTLSSection .Prefix }}
|
2018-01-23 15:30:07 +00:00
|
|
|
[[tls]]
|
2017-12-23 16:45:51 +00:00
|
|
|
|
2018-01-24 10:57:06 +00:00
|
|
|
entryPoints = [{{range $tls.EntryPoints }}
|
2017-12-23 16:45:51 +00:00
|
|
|
"{{.}}",
|
2017-11-23 10:50:03 +00:00
|
|
|
{{end}}]
|
|
|
|
|
2018-01-24 10:57:06 +00:00
|
|
|
[tls.certificate]
|
|
|
|
certFile = """{{ $tls.Certificate.CertFile }}"""
|
|
|
|
keyFile = """{{ $tls.Certificate.KeyFile }}"""
|
2017-12-23 16:45:51 +00:00
|
|
|
|
|
|
|
{{end}}
|