2017-12-16 21:22:16 +03:00
[backends]
2018-01-10 20:28:03 +03:00
{{range $ serviceName , $ instances := .Services }}
{{ $ firstInstance := index $ instances 0 }}
2017-12-16 21:22:16 +03:00
2018-01-10 20:28:03 +03:00
{{ $ circuitBreaker := getCircuitBreaker $ firstInstance }}
{{if $ circuitBreaker }}
[backends."backend-{{ $ serviceName }}".circuitBreaker]
expression = "{{ $ circuitBreaker . Expression }}"
2017-12-16 21:51:39 +03:00
{{end}}
2018-01-10 20:28:03 +03:00
{{ $ loadBalancer := getLoadBalancer $ firstInstance }}
{{if $ loadBalancer }}
[backends."backend-{{ $ serviceName }}".loadBalancer]
method = "{{ $ loadBalancer . Method }}"
sticky = {{ $ loadBalancer . Sticky }}
{{if $ loadBalancer . Stickiness }}
[backends."backend-{{ $ serviceName }}".loadBalancer.stickiness]
cookieName = "{{ $ loadBalancer . Stickiness . CookieName }}"
2017-10-10 12:10:02 +03:00
{{end}}
2017-12-16 21:38:12 +03:00
{{end}}
2017-01-05 17:24:17 +03:00
2018-01-10 20:28:03 +03:00
{{ $ maxConn := getMaxConn $ firstInstance }}
{{if $ maxConn }}
[backends."backend-{{ $ serviceName }}".maxConn]
extractorFunc = "{{ $ maxConn . ExtractorFunc }}"
amount = {{ $ maxConn . Amount }}
2017-12-16 21:57:40 +03:00
{{end}}
2018-01-10 20:28:03 +03:00
{{ $ healthCheck := getHealthCheck $ firstInstance }}
{{if $ healthCheck }}
2018-03-08 00:10:04 +03:00
[backends."backend-{{ $ serviceName }}".healthCheck]
2018-01-10 20:28:03 +03:00
path = "{{ $ healthCheck . Path }}"
port = {{ $ healthCheck . Port }}
interval = "{{ $ healthCheck . Interval }}"
2017-12-16 21:22:16 +03:00
{{end}}
2018-01-31 17:32:04 +03:00
{{ $ buffering := getBuffering $ firstInstance }}
{{if $ buffering }}
2018-03-08 00:10:04 +03:00
[backends."backend-{{ $ serviceName }}".buffering]
2018-01-31 17:32:04 +03:00
maxRequestBodyBytes = {{ $ buffering . MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $ buffering . MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $ buffering . MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $ buffering . MemResponseBodyBytes }}
retryExpression = "{{ $ buffering . RetryExpression }}"
{{end}}
2018-01-10 20:28:03 +03:00
{{range $ serverName , $ server := getServers $ instances }}
2018-03-08 00:10:04 +03:00
[backends."backend-{{ $ serviceName }}".servers."{{ $ serverName }}"]
2018-01-10 20:28:03 +03:00
url = "{{ $ server . URL }}"
weight = {{ $ server . Weight }}
2017-08-25 12:42:03 +03:00
{{end}}
2017-12-16 21:22:16 +03:00
2017-01-05 17:24:17 +03:00
{{end}}
2017-08-25 12:42:03 +03:00
2017-12-16 21:22:16 +03:00
[frontends]
2018-01-10 20:28:03 +03:00
{{range $ serviceName , $ instances := .Services }}
{{range $ instance := filterFrontends $ instances }}
2017-12-16 21:22:16 +03:00
2018-03-08 00:10:04 +03:00
[frontends."frontend-{{ $ serviceName }}"]
2017-12-16 21:22:16 +03:00
backend = "backend-{{ $ serviceName }}"
2018-01-10 20:28:03 +03:00
priority = {{ getPriority $ instance }}
passHostHeader = {{ getPassHostHeader $ instance }}
passTLSCert = {{ getPassTLSCert $ instance }}
2017-12-16 21:22:16 +03:00
2018-01-10 20:28:03 +03:00
entryPoints = [{{range getEntryPoints $ instance }}
2017-08-25 12:42:03 +03:00
"{{.}}",
2017-12-16 21:22:16 +03:00
{{end}}]
2018-01-10 20:28:03 +03:00
basicAuth = [{{range getBasicAuth $ instance }}
2017-09-07 18:34:03 +03:00
"{{.}}",
2017-12-16 21:22:16 +03:00
{{end}}]
2018-03-23 19:40:04 +03:00
{{ $ whitelist := getWhiteList $ instance }}
{{if $ whitelist }}
[frontends."frontend-{{ $ serviceName }}".whiteList]
sourceRange = [{{range $ whitelist . SourceRange }}
"{{.}}",
{{end}}]
useXForwardedFor = {{ $ whitelist . UseXForwardedFor }}
{{end}}
2018-01-10 20:28:03 +03:00
{{ $ redirect := getRedirect $ instance }}
{{if $ redirect }}
2017-12-16 22:12:44 +03:00
[frontends."frontend-{{ $ serviceName }}".redirect]
2018-01-10 20:28:03 +03:00
entryPoint = "{{ $ redirect . EntryPoint }}"
regex = "{{ $ redirect . Regex }}"
replacement = "{{ $ redirect . Replacement }}"
2018-01-31 21:10:04 +03:00
permanent = {{ $ redirect . Permanent }}
2017-12-21 00:59:57 +03:00
{{end}}
2018-01-10 20:28:03 +03:00
{{ $ errorPages := getErrorPages $ instance }}
{{if $ errorPages }}
2017-12-21 00:59:57 +03:00
[frontends."frontend-{{ $ serviceName }}".errors]
2018-01-10 20:28:03 +03:00
{{range $ pageName , $ page := $ errorPages }}
2018-03-08 00:10:04 +03:00
[frontends."frontend-{{ $ serviceName }}".errors."{{ $ pageName }}"]
2018-01-10 20:28:03 +03:00
status = [{{range $ page . Status }}
2017-12-21 00:59:57 +03:00
"{{.}}",
{{end}}]
2018-01-10 20:28:03 +03:00
backend = "{{ $ page . Backend }}"
query = "{{ $ page . Query }}"
2017-12-21 00:59:57 +03:00
{{end}}
{{end}}
2018-01-10 20:28:03 +03:00
{{ $ rateLimit := getRateLimit $ instance }}
{{if $ rateLimit }}
2017-12-21 00:59:57 +03:00
[frontends."frontend-{{ $ serviceName }}".rateLimit]
2018-01-10 20:28:03 +03:00
extractorFunc = "{{ $ rateLimit . ExtractorFunc }}"
2017-12-21 00:59:57 +03:00
[frontends."frontend-{{ $ serviceName }}".rateLimit.rateSet]
2018-01-10 20:28:03 +03:00
{{ range $ limitName , $ limit := $ rateLimit . RateSet }}
2018-03-08 00:10:04 +03:00
[frontends."frontend-{{ $ serviceName }}".rateLimit.rateSet."{{ $ limitName }}"]
2018-01-10 20:28:03 +03:00
period = "{{ $ limit . Period }}"
average = {{ $ limit . Average }}
burst = {{ $ limit . Burst }}
2017-12-21 00:59:57 +03:00
{{end}}
2017-12-16 22:12:44 +03:00
{{end}}
2018-01-10 20:28:03 +03:00
{{ $ headers := getHeaders $ instance }}
{{if $ headers }}
2017-12-16 22:24:30 +03:00
[frontends."frontend-{{ $ serviceName }}".headers]
2018-01-10 20:28:03 +03:00
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 16:24:03 +03:00
CustomBrowserXSSValue = "{{ $ headers . CustomBrowserXSSValue }}"
2018-01-10 20:28:03 +03: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-{{ $ serviceName }}".headers.customRequestHeaders]
{{range $k, $v := $ headers . CustomRequestHeaders }}
2017-12-16 22:24:30 +03:00
{{ $k}} = "{{ $v}}"
{{end}}
{{end}}
2018-01-10 20:28:03 +03:00
{{if $ headers . CustomResponseHeaders }}
2017-12-16 22:24:30 +03:00
[frontends."frontend-{{ $ serviceName }}".headers.customResponseHeaders]
2018-01-10 20:28:03 +03:00
{{range $k, $v := $ headers . CustomResponseHeaders }}
2017-12-16 22:24:30 +03:00
{{ $k}} = "{{ $v}}"
{{end}}
{{end}}
2018-01-10 20:28:03 +03:00
{{if $ headers . SSLProxyHeaders }}
2017-12-16 22:24:30 +03:00
[frontends."frontend-{{ $ serviceName }}".headers.SSLProxyHeaders]
2018-01-10 20:28:03 +03:00
{{range $k, $v := $ headers . SSLProxyHeaders }}
2017-12-16 22:24:30 +03:00
{{ $k}} = "{{ $v}}"
{{end}}
{{end}}
2018-01-02 17:57:04 +03:00
{{end}}
2017-12-16 22:24:30 +03:00
2018-03-08 00:10:04 +03:00
[frontends."frontend-{{ $ serviceName }}".routes."route-frontend-{{ $ serviceName }}"]
2017-12-21 00:59:57 +03:00
rule = "{{getFrontendRule $ instance }}"
2017-12-16 21:22:16 +03:00
{{end}}
2017-08-25 12:42:03 +03:00
{{end}}