2018-01-10 02:19:22 +00:00
|
|
|
[backends]
|
2018-01-10 20:54:46 +00:00
|
|
|
{{range $applicationName, $tasks := .ApplicationsTasks }}
|
|
|
|
{{ $app := index $tasks 0 }}
|
|
|
|
{{ $backendName := getBackendName $app }}
|
|
|
|
|
2018-03-07 21:10:04 +00:00
|
|
|
[backends."backend-{{ $backendName }}"]
|
2018-01-10 20:54:46 +00:00
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $circuitBreaker := getCircuitBreaker $app.TraefikLabels }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{if $circuitBreaker }}
|
|
|
|
[backends."backend-{{ $backendName }}".circuitBreaker]
|
|
|
|
expression = "{{ $circuitBreaker.Expression }}"
|
|
|
|
{{end}}
|
2018-01-10 02:19:22 +00:00
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $loadBalancer := getLoadBalancer $app.TraefikLabels }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{if $loadBalancer }}
|
|
|
|
[backends."backend-{{ $backendName }}".loadBalancer]
|
|
|
|
method = "{{ $loadBalancer.Method }}"
|
|
|
|
{{if $loadBalancer.Stickiness }}
|
|
|
|
[backends."backend-{{ $backendName }}".loadBalancer.stickiness]
|
|
|
|
cookieName = "{{ $loadBalancer.Stickiness.CookieName }}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
2018-01-10 02:19:22 +00:00
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $maxConn := getMaxConn $app.TraefikLabels }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{if $maxConn }}
|
|
|
|
[backends."backend-{{ $backendName }}".maxConn]
|
|
|
|
extractorFunc = "{{ $maxConn.ExtractorFunc }}"
|
|
|
|
amount = {{ $maxConn.Amount }}
|
|
|
|
{{end}}
|
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $healthCheck := getHealthCheck $app.TraefikLabels }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{if $healthCheck }}
|
2018-03-07 21:10:04 +00:00
|
|
|
[backends."backend-{{ $backendName }}".healthCheck]
|
2018-05-14 10:08:03 +00:00
|
|
|
scheme = "{{ $healthCheck.Scheme }}"
|
2018-01-10 20:54:46 +00:00
|
|
|
path = "{{ $healthCheck.Path }}"
|
|
|
|
port = {{ $healthCheck.Port }}
|
|
|
|
interval = "{{ $healthCheck.Interval }}"
|
2018-09-27 18:16:03 +00:00
|
|
|
timeout = "{{ $healthCheck.Timeout }}"
|
2018-04-16 09:40:03 +00:00
|
|
|
hostname = "{{ $healthCheck.Hostname }}"
|
|
|
|
{{if $healthCheck.Headers }}
|
|
|
|
[backends."backend-{{ $backendName }}".healthCheck.headers]
|
|
|
|
{{range $k, $v := $healthCheck.Headers }}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{end}}
|
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $buffering := getBuffering $app.TraefikLabels }}
|
2018-01-31 14:32:04 +00:00
|
|
|
{{if $buffering }}
|
2018-03-07 21:10:04 +00:00
|
|
|
[backends."backend-{{ $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}}
|
|
|
|
|
2018-01-10 20:54:46 +00:00
|
|
|
{{range $serverName, $server := getServers $tasks }}
|
2018-03-07 21:10:04 +00:00
|
|
|
[backends."backend-{{ $backendName }}".servers."{{ $serverName }}"]
|
2018-01-10 20:54:46 +00:00
|
|
|
url = "{{ $server.URL }}"
|
|
|
|
weight = {{ $server.Weight }}
|
|
|
|
{{end}}
|
2016-07-20 09:56:14 +00:00
|
|
|
{{end}}
|
|
|
|
|
2018-01-10 02:19:22 +00:00
|
|
|
[frontends]
|
2018-01-10 20:54:46 +00:00
|
|
|
{{range $applicationName, $tasks := .ApplicationsTasks }}
|
|
|
|
{{ $app := index $tasks 0 }}
|
2018-01-10 02:19:22 +00:00
|
|
|
{{ $frontendName := getFrontEndName $app }}
|
|
|
|
|
2018-03-07 21:10:04 +00:00
|
|
|
[frontends."frontend-{{ $frontendName }}"]
|
2018-01-10 20:54:46 +00:00
|
|
|
backend = "backend-{{ getBackendName $app }}"
|
2018-03-28 22:01:24 +00:00
|
|
|
priority = {{ getPriority $app.TraefikLabels }}
|
|
|
|
passHostHeader = {{ getPassHostHeader $app.TraefikLabels }}
|
|
|
|
passTLSCert = {{ getPassTLSCert $app.TraefikLabels }}
|
2018-01-10 02:19:22 +00:00
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
entryPoints = [{{range getEntryPoints $app.TraefikLabels }}
|
2018-01-10 02:19:22 +00:00
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
|
2018-08-29 09:36:03 +00:00
|
|
|
{{ $tlsClientCert := getPassTLSClientCert $app.TraefikLabels }}
|
|
|
|
{{if $tlsClientCert }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".passTLSClientCert]
|
|
|
|
pem = {{ $tlsClientCert.PEM }}
|
|
|
|
{{ $infos := $tlsClientCert.Infos }}
|
|
|
|
{{if $infos }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".passTLSClientCert.infos]
|
|
|
|
notAfter = {{ $infos.NotAfter }}
|
|
|
|
notBefore = {{ $infos.NotBefore }}
|
|
|
|
sans = {{ $infos.Sans }}
|
|
|
|
{{ $subject := $infos.Subject }}
|
|
|
|
{{if $subject }}
|
|
|
|
[frontends."frontend-{{ $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 $app.TraefikLabels }}
|
|
|
|
{{if $auth }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".auth]
|
|
|
|
headerField = "{{ $auth.HeaderField }}"
|
|
|
|
|
|
|
|
{{if $auth.Forward }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".auth.forward]
|
|
|
|
address = "{{ $auth.Forward.Address }}"
|
|
|
|
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }}
|
|
|
|
|
|
|
|
{{if $auth.Forward.TLS }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".auth.forward.tls]
|
|
|
|
ca = "{{ $auth.Forward.TLS.CA }}"
|
|
|
|
caOptional = {{ $auth.Forward.TLS.CAOptional }}
|
2018-08-21 15:12:03 +00:00
|
|
|
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}}
|
2018-01-10 20:54:46 +00:00
|
|
|
|
2018-07-06 14:52:04 +00:00
|
|
|
{{if $auth.Basic }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".auth.basic]
|
2018-07-16 11:52:03 +00:00
|
|
|
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."frontend-{{ $frontendName }}".auth.digest]
|
2018-07-16 11:52:03 +00:00
|
|
|
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-03-28 22:01:24 +00:00
|
|
|
{{ $whitelist := getWhiteList $app.TraefikLabels }}
|
2018-03-23 16:40:04 +00:00
|
|
|
{{if $whitelist }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".whiteList]
|
|
|
|
sourceRange = [{{range $whitelist.SourceRange }}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
2018-08-24 14:20:03 +00:00
|
|
|
{{if $whitelist.IPStrategy }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".whiteList.IPStrategy]
|
|
|
|
depth = {{ $whitelist.IPStrategy.Depth }}
|
|
|
|
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
2018-03-23 16:40:04 +00:00
|
|
|
{{end}}
|
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $redirect := getRedirect $app.TraefikLabels }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{if $redirect }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".redirect]
|
|
|
|
entryPoint = "{{ $redirect.EntryPoint }}"
|
|
|
|
regex = "{{ $redirect.Regex }}"
|
|
|
|
replacement = "{{ $redirect.Replacement }}"
|
2018-01-31 18:10:04 +00:00
|
|
|
permanent = {{ $redirect.Permanent }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{end}}
|
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $errorPages := getErrorPages $app.TraefikLabels }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{if $errorPages }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".errors]
|
|
|
|
{{range $pageName, $page := $errorPages }}
|
2018-03-07 21:10:04 +00:00
|
|
|
[frontends."frontend-{{ $frontendName }}".errors."{{ $pageName }}"]
|
2018-01-10 20:54:46 +00:00
|
|
|
status = [{{range $page.Status }}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
2018-04-11 11:54:03 +00:00
|
|
|
backend = "backend-{{ $page.Backend }}"
|
2018-01-10 20:54:46 +00:00
|
|
|
query = "{{ $page.Query }}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $rateLimit := getRateLimit $app.TraefikLabels }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{if $rateLimit }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".rateLimit]
|
|
|
|
extractorFunc = "{{ $rateLimit.ExtractorFunc }}"
|
|
|
|
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet]
|
|
|
|
{{ range $limitName, $limit := $rateLimit.RateSet }}
|
2018-03-07 21:10:04 +00:00
|
|
|
[frontends."frontend-{{ $frontendName }}".rateLimit.rateSet."{{ $limitName }}"]
|
2018-01-10 20:54:46 +00:00
|
|
|
period = "{{ $limit.Period }}"
|
|
|
|
average = {{ $limit.Average }}
|
|
|
|
burst = {{ $limit.Burst }}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-03-28 22:01:24 +00:00
|
|
|
{{ $headers := getHeaders $app.TraefikLabels }}
|
2018-01-10 20:54:46 +00:00
|
|
|
{{if $headers }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".headers]
|
|
|
|
SSLRedirect = {{ $headers.SSLRedirect }}
|
|
|
|
SSLTemporaryRedirect = {{ $headers.SSLTemporaryRedirect }}
|
|
|
|
SSLHost = "{{ $headers.SSLHost }}"
|
2018-05-14 09:44:03 +00:00
|
|
|
SSLForceHost = {{ $headers.SSLForceHost }}
|
2018-01-10 20:54:46 +00:00
|
|
|
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-10 20:54:46 +00:00
|
|
|
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."frontend-{{ $frontendName }}".headers.customRequestHeaders]
|
|
|
|
{{range $k, $v := $headers.CustomRequestHeaders }}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{if $headers.CustomResponseHeaders }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".headers.customResponseHeaders]
|
|
|
|
{{range $k, $v := $headers.CustomResponseHeaders }}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{if $headers.SSLProxyHeaders }}
|
|
|
|
[frontends."frontend-{{ $frontendName }}".headers.SSLProxyHeaders]
|
|
|
|
{{range $k, $v := $headers.SSLProxyHeaders }}
|
|
|
|
{{$k}} = "{{$v}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-03-07 21:10:04 +00:00
|
|
|
[frontends."frontend-{{ $frontendName }}".routes."route-host-{{ $frontendName }}"]
|
2018-01-10 20:54:46 +00:00
|
|
|
rule = "{{ getFrontendRule $app }}"
|
2018-01-10 02:19:22 +00:00
|
|
|
|
2018-01-10 20:54:46 +00:00
|
|
|
{{end}}
|