2017-01-28 23:01:56 +00:00
|
|
|
{{$backendServers := .Backends}}
|
2017-12-16 12:49:12 +00:00
|
|
|
[backends]
|
|
|
|
{{range $backendName, $backend := .Backends}}
|
2017-01-28 23:01:56 +00:00
|
|
|
|
2017-12-20 15:33:26 +00:00
|
|
|
[backends.backend-{{$backendName}}]
|
|
|
|
|
2017-12-16 12:49:12 +00:00
|
|
|
{{if hasCircuitBreakerLabel $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.circuitBreaker]
|
|
|
|
expression = "{{getCircuitBreakerExpression $backend}}"
|
|
|
|
{{end}}
|
2017-01-28 23:01:56 +00:00
|
|
|
|
2017-12-16 12:49:12 +00:00
|
|
|
{{if hasLoadBalancerLabel $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.loadBalancer]
|
|
|
|
method = "{{getLoadBalancerMethod $backend}}"
|
|
|
|
sticky = {{getSticky $backend}}
|
|
|
|
{{if hasStickinessLabel $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.loadBalancer.stickiness]
|
|
|
|
cookieName = "{{getStickinessCookieName $backend}}"
|
2017-01-28 23:01:56 +00:00
|
|
|
{{end}}
|
2017-12-16 12:49:12 +00:00
|
|
|
{{end}}
|
2017-01-28 23:01:56 +00:00
|
|
|
|
2017-12-16 12:49:12 +00:00
|
|
|
{{if hasMaxConnLabels $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.maxConn]
|
|
|
|
amount = {{getMaxConnAmount $backend}}
|
|
|
|
extractorFunc = "{{getMaxConnExtractorFunc $backend}}"
|
|
|
|
{{end}}
|
|
|
|
|
2017-12-16 13:21:33 +00:00
|
|
|
{{if hasHealthCheckLabels $backend}}
|
|
|
|
[backends.backend-{{$backendName}}.healthCheck]
|
|
|
|
path = "{{getHealthCheckPath $backend}}"
|
|
|
|
port = {{getHealthCheckPort $backend}}
|
|
|
|
interval = "{{getHealthCheckInterval $backend}}"
|
|
|
|
{{end}}
|
|
|
|
|
2017-12-16 12:49:12 +00:00
|
|
|
{{range $index, $ip := $backend.Containers}}
|
|
|
|
[backends.backend-{{$backendName}}.servers.server-{{$index}}]
|
|
|
|
url = "{{getProtocol $backend}}://{{$ip}}:{{getPort $backend}}"
|
|
|
|
weight = {{getWeight $backend}}
|
|
|
|
{{end}}
|
2017-01-28 23:01:56 +00:00
|
|
|
|
|
|
|
{{end}}
|
|
|
|
|
2017-12-16 12:49:12 +00:00
|
|
|
[frontends]
|
|
|
|
{{range $frontendName, $service := .Frontends}}
|
|
|
|
|
|
|
|
[frontends."frontend-{{$frontendName}}"]
|
2017-01-28 23:01:56 +00:00
|
|
|
backend = "backend-{{getBackend $service}}"
|
|
|
|
priority = {{getPriority $service}}
|
2017-12-16 12:49:12 +00:00
|
|
|
passHostHeader = {{getPassHostHeader $service}}
|
2017-12-16 13:16:57 +00:00
|
|
|
passTLSCert = {{getPassTLSCert $service}}
|
2017-12-16 12:49:12 +00:00
|
|
|
|
2017-01-28 23:01:56 +00:00
|
|
|
entryPoints = [{{range getEntryPoints $service}}
|
2017-12-16 12:49:12 +00:00
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
|
2017-12-16 13:18:37 +00:00
|
|
|
{{if getWhitelistSourceRange $service}}
|
|
|
|
whitelistSourceRange = [{{range getWhitelistSourceRange $service}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
|
|
|
|
2017-04-19 09:14:05 +00:00
|
|
|
basicAuth = [{{range getBasicAuth $service}}
|
2017-12-16 12:49:12 +00:00
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
2017-12-15 10:48:03 +00:00
|
|
|
|
|
|
|
{{if hasRedirect $service}}
|
|
|
|
[frontends."frontend-{{$frontendName}}".redirect]
|
2017-12-16 12:49:12 +00:00
|
|
|
entryPoint = "{{getRedirectEntryPoint $service}}"
|
|
|
|
regex = "{{getRedirectRegex $service}}"
|
|
|
|
replacement = "{{getRedirectReplacement $service}}"
|
2017-12-15 10:48:03 +00:00
|
|
|
{{end}}
|
|
|
|
|
2017-12-20 15:33:26 +00:00
|
|
|
{{ if hasErrorPages $service }}
|
|
|
|
[frontends."frontend-{{$frontendName}}".errors]
|
|
|
|
{{ range $pageName, $page := getErrorPages $service }}
|
|
|
|
[frontends."frontend-{{$frontendName}}".errors.{{ $pageName }}]
|
|
|
|
status = [{{range $page.Status}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
backend = "{{$page.Backend}}"
|
|
|
|
query = "{{$page.Query}}"
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{ if hasRateLimits $service }}
|
|
|
|
[frontends."frontend-{{$frontendName}}".rateLimit]
|
|
|
|
extractorFunc = "{{ getRateLimitsExtractorFunc $service }}"
|
|
|
|
[frontends."frontend-{{$frontendName}}".rateLimit.rateSet]
|
|
|
|
{{ range $limitName, $rateLimit := getRateLimits $service }}
|
|
|
|
[frontends."frontend-{{$frontendName}}".rateLimit.rateSet.{{ $limitName }}]
|
|
|
|
period = "{{ $rateLimit.Period }}"
|
|
|
|
average = {{ $rateLimit.Average }}
|
|
|
|
burst = {{ $rateLimit.Burst }}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
2018-01-02 15:10:37 +00:00
|
|
|
{{if hasHeaders $service }}
|
2017-12-20 15:33:26 +00:00
|
|
|
[frontends."frontend-{{$frontendName}}".headers]
|
2018-01-02 15:10:37 +00:00
|
|
|
SSLRedirect = {{getSSLRedirectHeaders $service}}
|
|
|
|
SSLTemporaryRedirect = {{getSSLTemporaryRedirectHeaders $service}}
|
|
|
|
SSLHost = "{{getSSLHostHeaders $service}}"
|
|
|
|
STSSeconds = {{getSTSSecondsHeaders $service}}
|
|
|
|
STSIncludeSubdomains = {{getSTSIncludeSubdomainsHeaders $service}}
|
|
|
|
STSPreload = {{getSTSPreloadHeaders $service}}
|
|
|
|
ForceSTSHeader = {{getForceSTSHeaderHeaders $service}}
|
|
|
|
FrameDeny = {{getFrameDenyHeaders $service}}
|
|
|
|
CustomFrameOptionsValue = "{{getCustomFrameOptionsValueHeaders $service}}"
|
|
|
|
ContentTypeNosniff = {{getContentTypeNosniffHeaders $service}}
|
|
|
|
BrowserXSSFilter = {{getBrowserXSSFilterHeaders $service}}
|
|
|
|
ContentSecurityPolicy = "{{getContentSecurityPolicyHeaders $service}}"
|
|
|
|
PublicKey = "{{getPublicKeyHeaders $service}}"
|
|
|
|
ReferrerPolicy = "{{getReferrerPolicyHeaders $service}}"
|
|
|
|
IsDevelopment = {{getIsDevelopmentHeaders $service}}
|
|
|
|
|
|
|
|
AllowedHosts = [{{range getAllowedHostsHeaders $service}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
|
|
|
|
HostsProxyHeaders = [{{range getHostsProxyHeaders $service}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
|
|
|
|
{{if hasRequestHeaders $service}}
|
|
|
|
[frontends."frontend-{{$frontendName}}".headers.customRequestHeaders]
|
|
|
|
{{range $k, $v := getRequestHeaders $service}}
|
|
|
|
{{$k}} = "{{$v}}"
|
2017-12-16 13:25:10 +00:00
|
|
|
{{end}}
|
2018-01-02 15:10:37 +00:00
|
|
|
{{end}}
|
|
|
|
{{if hasResponseHeaders $service}}
|
|
|
|
[frontends."frontend-{{$frontendName}}".headers.customResponseHeaders]
|
|
|
|
{{range $k, $v := getResponseHeaders $service}}
|
|
|
|
{{$k}} = "{{$v}}"
|
2017-12-16 13:25:10 +00:00
|
|
|
{{end}}
|
2018-01-02 15:10:37 +00:00
|
|
|
{{end}}
|
|
|
|
{{if hasSSLProxyHeaders $service}}
|
|
|
|
[frontends."frontend-{{$frontendName}}".headers.SSLProxyHeaders]
|
|
|
|
{{range $k, $v := getSSLProxyHeaders $service}}
|
|
|
|
{{$k}} = "{{$v}}"
|
2017-12-16 13:25:10 +00:00
|
|
|
{{end}}
|
2018-01-02 15:10:37 +00:00
|
|
|
{{end}}
|
|
|
|
{{end}}
|
2017-12-16 13:25:10 +00:00
|
|
|
|
2017-01-28 23:01:56 +00:00
|
|
|
[frontends."frontend-{{$frontendName}}".routes."route-frontend-{{$frontendName}}"]
|
2017-12-16 12:49:12 +00:00
|
|
|
rule = "{{getFrontendRule $service}}"
|
|
|
|
|
2017-01-28 23:01:56 +00:00
|
|
|
{{end}}
|