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 }}"
|
|
|
|
{{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 }}
|
2018-09-14 07:00:03 +00:00
|
|
|
[backends."{{ $backendName }}".healthCheck]
|
2018-05-14 10:08:03 +00:00
|
|
|
scheme = "{{ $healthCheck.Scheme }}"
|
2018-01-05 16:31:24 +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 }}
|
2018-09-14 07:00:03 +00:00
|
|
|
[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 }}
|
2018-09-14 07:00:03 +00:00
|
|
|
[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}}
|
|
|
|
|
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-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 }}
|
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}}
|
|
|
|
|
|
|
|
{{if $auth.Basic }}
|
|
|
|
[frontends."{{ $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."{{ $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-01-03 15:32:11 +00:00
|
|
|
|
2018-03-23 16:40:04 +00:00
|
|
|
{{ $whitelist := getWhiteList $frontend }}
|
|
|
|
{{if $whitelist }}
|
|
|
|
[frontends."{{ $frontendName }}".whiteList]
|
|
|
|
sourceRange = [{{range $whitelist.SourceRange }}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
2018-08-24 14:20:03 +00:00
|
|
|
{{if $whitelist.IPStrategy }}
|
|
|
|
[frontends."{{ $frontendName }}".whiteList.IPStrategy]
|
|
|
|
depth = {{ $whitelist.IPStrategy.Depth }}
|
|
|
|
excludedIPs = [{{range $whitelist.IPStrategy.ExcludedIPs }}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
2018-03-23 16:40:04 +00:00
|
|
|
{{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 }}"
|
2018-05-14 09:44:03 +00:00
|
|
|
SSLForceHost = {{ $headers.SSLForceHost }}
|
2018-01-03 15:49:13 +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-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}}
|