2018-01-10 11:58:03 +01:00
{{ $ apps := .Applications }}
2017-05-22 23:21:15 +02:00
2017-12-16 14:47:03 +01:00
[backends]
2018-01-10 11:58:03 +01:00
{{range $ app := $ apps }}
{{range $ serviceIndex , $ serviceName := getServiceNames $ app }}
{{ $ backendName := getBackend $ app $ serviceName }}
[backends."{{ $ backendName }}"]
{{ $ circuitBreaker := getCircuitBreaker $ app }}
{{if $ circuitBreaker }}
[backends."{{ $ backendName }}".circuitBreaker]
expression = "{{ $ circuitBreaker . Expression }}"
{{end}}
{{ $ loadBalancer := getLoadBalancer $ app }}
{{if $ loadBalancer }}
[backends."{{ $ backendName }}".loadBalancer]
method = "{{ $ loadBalancer . Method }}"
sticky = {{ $ loadBalancer . Sticky }}
{{if $ loadBalancer . Stickiness }}
[backends."{{ $ backendName }}".loadBalancer.stickiness]
cookieName = "{{ $ loadBalancer . Stickiness . CookieName }}"
2017-12-16 14:47:03 +01:00
{{end}}
{{end}}
2018-01-10 11:58:03 +01:00
{{ $ maxConn := getMaxConn $ app }}
{{if $ maxConn }}
[backends."{{ $ backendName }}".maxConn]
extractorFunc = "{{ $ maxConn . ExtractorFunc }}"
amount = {{ $ maxConn . Amount }}
2017-12-16 14:47:03 +01:00
{{end}}
2018-01-10 11:58:03 +01:00
{{ $ healthCheck := getHealthCheck $ app }}
{{if $ healthCheck }}
[backends."{{ $ backendName }}".healthCheck]
path = "{{ $ healthCheck . Path }}"
port = {{ $ healthCheck . Port }}
interval = "{{ $ healthCheck . Interval }}"
2017-12-16 14:47:03 +01:00
{{end}}
2018-01-31 15:32:04 +01:00
{{ $ buffering := getBuffering $ app }}
{{if $ buffering }}
[backends."{{ $ backendName }}".buffering]
maxRequestBodyBytes = {{ $ buffering . MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $ buffering . MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $ buffering . MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $ buffering . MemResponseBodyBytes }}
retryExpression = "{{ $ buffering . RetryExpression }}"
{{end}}
2018-01-10 11:58:03 +01:00
{{range $ serverName , $ server := getServers $ app $ serviceName }}
[backends."{{ $ backendName }}".servers."{{ $ serverName }}"]
url = "{{ $ server . URL }}"
weight = {{ $ server . Weight }}
2017-12-16 14:47:03 +01:00
{{end}}
2015-09-09 22:39:08 +02:00
{{end}}
2018-01-10 11:58:03 +01:00
{{end}}
2015-09-09 22:39:08 +02:00
2017-12-16 14:47:03 +01:00
[frontends]
2018-01-10 11:58:03 +01:00
{{range $ app := $ apps }}
{{range $ serviceIndex , $ serviceName := getServiceNames $ app }}
{{ $ frontendName := getFrontendName $ app $ serviceName }}
2016-08-13 12:55:15 -04:00
2018-01-10 11:58:03 +01:00
[frontends."{{ $ frontendName }}"]
backend = "{{ getBackend $ app $ serviceName }}"
priority = {{ getPriority $ app $ serviceName }}
passHostHeader = {{ getPassHostHeader $ app $ serviceName }}
passTLSCert = {{ getPassTLSCert $ app $ serviceName }}
2017-12-16 14:47:03 +01:00
2018-01-10 11:58:03 +01:00
entryPoints = [{{range getEntryPoints $ app $ serviceName }}
2017-12-16 14:47:03 +01:00
"{{.}}",
{{end}}]
2018-01-10 11:58:03 +01:00
{{ $ whitelistSourceRange := getWhitelistSourceRange $ app $ serviceName }}
{{if $ whitelistSourceRange }}
whitelistSourceRange = [{{range $ whitelistSourceRange }}
2017-12-16 15:01:45 +01:00
"{{.}}",
{{end}}]
{{end}}
2018-01-10 11:58:03 +01:00
basicAuth = [{{range getBasicAuth $ app $ serviceName }}
2017-12-16 14:47:03 +01:00
"{{.}}",
{{end}}]
2018-01-10 11:58:03 +01:00
{{ $ redirect := getRedirect $ app $ serviceName }}
{{if $ redirect }}
[frontends."{{ $ frontendName }}".redirect]
entryPoint = "{{ $ redirect . EntryPoint }}"
regex = "{{ $ redirect . Regex }}"
replacement = "{{ $ redirect . Replacement }}"
2018-01-31 19:10:04 +01:00
permanent = {{ $ redirect . Permanent }}
2018-01-10 11:58:03 +01:00
{{end}}
{{ $ errorPages := getErrorPages $ app $ serviceName }}
{{if $ errorPages }}
[frontends."{{ $ frontendName }}".errors]
{{range $ pageName , $ page := $ errorPages }}
2018-03-07 22:10:04 +01:00
[frontends."{{ $ frontendName }}".errors."{{ $ pageName }}"]
2018-01-10 11:58:03 +01:00
status = [{{range $ page . Status }}
"{{.}}",
{{end}}]
backend = "{{ $ page . Backend }}"
query = "{{ $ page . Query }}"
2017-12-20 16:33:57 +01:00
{{end}}
{{end}}
2018-01-10 11:58:03 +01:00
{{ $ rateLimit := getRateLimit $ app $ serviceName }}
{{if $ rateLimit }}
[frontends."{{ $ frontendName }}".rateLimit]
extractorFunc = "{{ $ rateLimit . ExtractorFunc }}"
[frontends."{{ $ frontendName }}".rateLimit.rateSet]
{{ range $ limitName , $ limit := $ rateLimit . RateSet }}
2018-03-07 22:10:04 +01:00
[frontends."{{ $ frontendName }}".rateLimit.rateSet."{{ $ limitName }}"]
2018-01-10 11:58:03 +01:00
period = "{{ $ limit . Period }}"
average = {{ $ limit . Average }}
burst = {{ $ limit . Burst }}
2017-12-20 16:33:57 +01:00
{{end}}
{{end}}
2018-01-10 11:58:03 +01:00
{{ $ headers := getHeaders $ app $ serviceName }}
{{if $ headers }}
[frontends."{{ $ frontendName }}".headers]
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 14:24:03 +01:00
CustomBrowserXSSValue = "{{ $ headers . CustomBrowserXSSValue }}"
2018-01-10 11:58:03 +01:00
ContentSecurityPolicy = "{{ $ headers . ContentSecurityPolicy }}"
PublicKey = "{{ $ headers . PublicKey }}"
ReferrerPolicy = "{{ $ headers . ReferrerPolicy }}"
IsDevelopment = {{ $ headers . IsDevelopment }}
{{if $ headers . AllowedHosts }}
AllowedHosts = [{{range $ headers . AllowedHosts }}
"{{.}}",
{{end}}]
{{end}}
2018-01-02 09:42:03 +01:00
2018-01-10 11:58:03 +01:00
{{if $ headers . HostsProxyHeaders }}
HostsProxyHeaders = [{{range $ headers . HostsProxyHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-01-02 09:42:03 +01:00
2018-01-10 11:58:03 +01:00
{{if $ headers . CustomRequestHeaders }}
[frontends."{{ $ frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $ headers . CustomRequestHeaders }}
{{ $k}} = "{{ $v}}"
{{end}}
2017-12-16 15:36:17 +01:00
{{end}}
2018-01-02 09:42:03 +01:00
2018-01-10 11:58:03 +01:00
{{if $ headers . CustomResponseHeaders }}
[frontends."{{ $ frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $ headers . CustomResponseHeaders }}
{{ $k}} = "{{ $v}}"
{{end}}
2017-12-16 15:36:17 +01:00
{{end}}
2018-01-02 09:42:03 +01:00
2018-01-10 11:58:03 +01:00
{{if $ headers . SSLProxyHeaders }}
[frontends."{{ $ frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $ headers . SSLProxyHeaders }}
{{ $k}} = "{{ $v}}"
{{end}}
2017-12-16 15:36:17 +01:00
{{end}}
2018-01-02 09:42:03 +01:00
{{end}}
2017-12-16 15:36:17 +01:00
2018-01-10 11:58:03 +01:00
[frontends."{{ $ frontendName }}".routes."route-host{{ $ app . ID | replace "/" "-" }}{{ getServiceNameSuffix $ serviceName }}"]
rule = "{{ getFrontendRule $ app $ serviceName }}"
2017-12-16 14:47:03 +01:00
{{end}}
{{end}}