traefik/templates/kv.tmpl

266 lines
8.7 KiB
Cheetah
Raw Normal View History

2017-12-23 16:45:51 +00:00
[backends]
{{range $backend := List .Prefix "/backends/" }}
{{ $backendName := Last $backend }}
2017-12-23 16:45:51 +00:00
{{ $circuitBreaker := getCircuitBreaker $backend }}
{{if $circuitBreaker }}
[backends."{{ $backendName }}".circuitBreaker]
expression = "{{ $circuitBreaker.Expression }}"
2017-12-23 16:45:51 +00:00
{{end}}
{{ $loadBalancer := getLoadBalancer $backend }}
{{if $loadBalancer }}
[backends."{{ $backendName }}".loadBalancer]
method = "{{ $loadBalancer.Method }}"
{{if $loadBalancer.Stickiness }}
[backends."{{ $backendName }}".loadBalancer.stickiness]
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
{{end}}
2017-12-23 16:45:51 +00:00
{{end}}
{{ $maxConn := getMaxConn $backend }}
{{if $maxConn }}
[backends."{{ $backendName }}".maxConn]
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
amount = {{ $maxConn.Amount }}
2017-12-23 16:45:51 +00:00
{{end}}
{{ $healthCheck := getHealthCheck $backend }}
{{if $healthCheck }}
[backends."{{ $backendName }}".healthCheck]
2018-05-14 10:08:03 +00:00
scheme = "{{ $healthCheck.Scheme }}"
path = "{{ $healthCheck.Path }}"
port = {{ $healthCheck.Port }}
interval = "{{ $healthCheck.Interval }}"
2018-04-16 09:40:03 +00:00
hostname = "{{ $healthCheck.Hostname }}"
{{if $healthCheck.Headers }}
[backends."{{ $backendName }}".healthCheck.headers]
2018-04-16 09:40:03 +00:00
{{range $k, $v := $healthCheck.Headers }}
{{$k}} = "{{$v}}"
{{end}}
{{end}}
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]
2018-01-31 14:32:04 +00:00
maxRequestBodyBytes = {{ $buffering.MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $buffering.MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $buffering.MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $buffering.MemResponseBodyBytes }}
retryExpression = "{{ $buffering.RetryExpression }}"
{{end}}
{{range $serverName, $server := getServers $backend}}
[backends."{{ $backendName }}".servers."{{ $serverName }}"]
url = "{{ $server.URL }}"
weight = {{ $server.Weight }}
2017-12-23 16:45:51 +00:00
{{end}}
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 }}
2017-12-23 16:45:51 +00:00
[frontends."{{ $frontendName }}"]
backend = "{{ getBackendName $frontend }}"
priority = {{ getPriority $frontend }}
passHostHeader = {{ getPassHostHeader $frontend }}
passTLSCert = {{ getPassTLSCert $frontend }}
2017-12-23 16:45:51 +00:00
entryPoints = [{{range getEntryPoints $frontend }}
2016-02-01 15:08:58 +00:00
"{{.}}",
2017-12-23 16:45:51 +00:00
{{end}}]
2018-08-29 09:36:03 +00:00
{{ $tlsClientCert := getPassTLSClientCert $frontend }}
{{if $tlsClientCert }}
[frontends."{{ $frontendName }}".passTLSClientCert]
pem = {{ $tlsClientCert.PEM }}
{{ $infos := $tlsClientCert.Infos }}
{{if $infos }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos]
notAfter = {{ $infos.NotAfter }}
notBefore = {{ $infos.NotBefore }}
sans = {{ $infos.Sans }}
{{ $subject := $infos.Subject }}
{{if $subject }}
[frontends."{{ $frontendName }}".passTLSClientCert.infos.subject]
country = {{ $subject.Country }}
province = {{ $subject.Province }}
locality = {{ $subject.Locality }}
organization = {{ $subject.Organization }}
commonName = {{ $subject.CommonName }}
serialNumber = {{ $subject.SerialNumber }}
{{end}}
{{end}}
{{end}}
2018-07-06 14:52:04 +00:00
{{ $auth := getAuth $frontend }}
{{if $auth }}
[frontends."{{ $frontendName }}".auth]
headerField = "{{ $auth.HeaderField }}"
{{if $auth.Forward }}
[frontends."{{ $frontendName }}".auth.forward]
address = "{{ $auth.Forward.Address }}"
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
{{if $auth.Forward.TLS }}
[frontends."{{ $frontendName }}".auth.forward.tls]
ca = "{{ $auth.Forward.TLS.CA }}"
caOptional = {{ $auth.Forward.TLS.CAOptional }}
cert = """{{ $auth.Forward.TLS.Cert }}"""
key = """{{ $auth.Forward.TLS.Key }}"""
2018-07-06 14:52:04 +00:00
insecureSkipVerify = {{ $auth.Forward.TLS.InsecureSkipVerify }}
{{end}}
{{end}}
{{if $auth.Basic }}
[frontends."{{ $frontendName }}".auth.basic]
removeHeader = {{ $auth.Basic.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Basic.Users }}
users = [{{range $auth.Basic.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Basic.UsersFile }}"
{{end}}
{{if $auth.Digest }}
[frontends."{{ $frontendName }}".auth.digest]
removeHeader = {{ $auth.Digest.RemoveHeader }}
2018-07-06 14:52:04 +00:00
{{if $auth.Digest.Users }}
users = [{{range $auth.Digest.Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $auth.Digest.UsersFile }}"
{{end}}
{{end}}
2018-01-03 15:32:11 +00:00
{{ $whitelist := getWhiteList $frontend }}
{{if $whitelist }}
[frontends."{{ $frontendName }}".whiteList]
sourceRange = [{{range $whitelist.SourceRange }}
"{{.}}",
{{end}}]
{{if $whitelist.IPStrategy }}
[frontends."{{ $frontendName }}".whiteList.IPStrategy]
depth = {{ $whitelist.IPStrategy.Depth }}
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
"{{.}}",
{{end}}]
{{end}}
{{end}}
{{ $redirect := getRedirect $frontend }}
{{if $redirect }}
[frontends."{{ $frontendName }}".redirect]
entryPoint = "{{ $redirect.EntryPoint }}"
regex = "{{ $redirect.Regex }}"
replacement = "{{ $redirect.Replacement }}"
2018-01-31 18:10:04 +00:00
permanent = {{ $redirect.Permanent }}
{{end}}
{{ $errorPages := getErrorPages $frontend }}
{{if $errorPages }}
[frontends."{{ $frontendName }}".errors]
{{range $pageName, $page := $errorPages }}
2018-03-07 21:10:04 +00:00
[frontends."{{$frontendName}}".errors."{{ $pageName }}"]
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
backend = "{{$page.Backend}}"
query = "{{$page.Query}}"
{{end}}
{{end}}
{{ $rateLimit := getRateLimit $frontend }}
{{if $rateLimit }}
[frontends."{{ $frontendName }}".rateLimit]
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
[frontends."{{ $frontendName }}".rateLimit.rateSet]
{{range $limitName, $rateLimit := $rateLimit.RateSet }}
2018-03-07 21:10:04 +00:00
[frontends."{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
period = "{{ $rateLimit.Period }}"
average = {{ $rateLimit.Average }}
burst = {{ $rateLimit.Burst }}
{{end}}
{{end}}
{{ $headers := getHeaders $frontend }}
{{if $headers }}
[frontends."{{ $frontendName }}".headers]
SSLRedirect = {{ $headers.SSLRedirect }}
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
SSLHost = "{{ $headers.SSLHost }}"
2018-05-14 09:44:03 +00:00
SSLForceHost = {{ $headers.SSLForceHost }}
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 }}"
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}}
{{range $routeName, $route := getRoutes $frontend }}
[frontends."{{ $frontendName }}".routes."{{ $routeName }}"]
rule = "{{ $route.Rule }}"
2017-12-23 16:45:51 +00:00
{{end}}
{{end}}
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
"{{.}}",
{{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}}