2018-01-10 13:58:03 +03:00
{{ $ apps := .Applications }}
2017-05-23 00:21:15 +03:00
2017-12-16 16:47:03 +03:00
[backends]
2018-04-04 13:28:03 +03:00
{{range $ backendName , $ app := $ apps }}
2018-01-10 13:58:03 +03:00
[backends."{{ $ backendName }}"]
2018-03-26 16:32:04 +03:00
{{ $ circuitBreaker := getCircuitBreaker $ app . SegmentLabels }}
2018-01-10 13:58:03 +03:00
{{if $ circuitBreaker }}
[backends."{{ $ backendName }}".circuitBreaker]
expression = "{{ $ circuitBreaker . Expression }}"
{{end}}
2018-03-26 16:32:04 +03:00
{{ $ loadBalancer := getLoadBalancer $ app . SegmentLabels }}
2018-01-10 13:58:03 +03:00
{{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 16:47:03 +03:00
{{end}}
{{end}}
2018-03-26 16:32:04 +03:00
{{ $ maxConn := getMaxConn $ app . SegmentLabels }}
2018-01-10 13:58:03 +03:00
{{if $ maxConn }}
[backends."{{ $ backendName }}".maxConn]
extractorFunc = "{{ $ maxConn . ExtractorFunc }}"
amount = {{ $ maxConn . Amount }}
2017-12-16 16:47:03 +03:00
{{end}}
2018-03-26 16:32:04 +03:00
{{ $ healthCheck := getHealthCheck $ app . SegmentLabels }}
2018-01-10 13:58:03 +03:00
{{if $ healthCheck }}
[backends."{{ $ backendName }}".healthCheck]
2018-05-14 13:08:03 +03:00
scheme = "{{ $ healthCheck . Scheme }}"
2018-01-10 13:58:03 +03:00
path = "{{ $ healthCheck . Path }}"
port = {{ $ healthCheck . Port }}
interval = "{{ $ healthCheck . Interval }}"
2018-04-16 12:40:03 +03:00
hostname = "{{ $ healthCheck . Hostname }}"
{{if $ healthCheck . Headers }}
[backends.{{ $ backendName }}.healthCheck.headers]
{{range $k, $v := $ healthCheck . Headers }}
{{ $k}} = "{{ $v}}"
{{end}}
{{end}}
2017-12-16 16:47:03 +03:00
{{end}}
2018-03-26 16:32:04 +03:00
{{ $ buffering := getBuffering $ app . SegmentLabels }}
2018-01-31 17:32:04 +03:00
{{if $ buffering }}
[backends."{{ $ backendName }}".buffering]
maxRequestBodyBytes = {{ $ buffering . MaxRequestBodyBytes }}
memRequestBodyBytes = {{ $ buffering . MemRequestBodyBytes }}
maxResponseBodyBytes = {{ $ buffering . MaxResponseBodyBytes }}
memResponseBodyBytes = {{ $ buffering . MemResponseBodyBytes }}
retryExpression = "{{ $ buffering . RetryExpression }}"
{{end}}
2018-03-26 16:32:04 +03:00
{{range $ serverName , $ server := getServers $ app }}
2018-01-10 13:58:03 +03:00
[backends."{{ $ backendName }}".servers."{{ $ serverName }}"]
url = "{{ $ server . URL }}"
weight = {{ $ server . Weight }}
2017-12-16 16:47:03 +03:00
{{end}}
2015-09-09 23:39:08 +03:00
{{end}}
2017-12-16 16:47:03 +03:00
[frontends]
2018-04-04 13:28:03 +03:00
{{range $ backendName , $ app := $ apps }}
2018-03-26 16:32:04 +03:00
{{ $ frontendName := getFrontendName $ app }}
2016-08-13 19:55:15 +03:00
2018-01-10 13:58:03 +03:00
[frontends."{{ $ frontendName }}"]
2018-04-04 13:28:03 +03:00
backend = "{{ $ backendName }}"
2018-03-26 16:32:04 +03:00
priority = {{ getPriority $ app . SegmentLabels }}
passHostHeader = {{ getPassHostHeader $ app . SegmentLabels }}
passTLSCert = {{ getPassTLSCert $ app . SegmentLabels }}
2017-12-16 16:47:03 +03:00
2018-03-26 16:32:04 +03:00
entryPoints = [{{range getEntryPoints $ app . SegmentLabels }}
2017-12-16 16:47:03 +03:00
"{{.}}",
{{end}}]
2018-07-06 17:52:04 +03:00
{{ $ auth := getAuth $ app . SegmentLabels }}
{{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 }}
cert = "{{ $ auth . Forward . TLS . Cert }}"
key = "{{ $ auth . Forward . TLS . Key }}"
insecureSkipVerify = {{ $ auth . Forward . TLS . InsecureSkipVerify }}
{{end}}
{{end}}
{{if $ auth . Basic }}
[frontends."{{ $ frontendName }}".auth.basic]
2018-07-16 14:52:03 +03:00
removeHeader = {{ $ auth . Basic . RemoveHeader }}
2018-07-06 17:52:04 +03: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 14:52:03 +03:00
removeHeader = {{ $ auth . Digest . RemoveHeader }}
2018-07-06 17:52:04 +03:00
{{if $ auth . Digest . Users }}
users = [{{range $ auth . Digest . Users }}
"{{.}}",
{{end}}]
{{end}}
usersFile = "{{ $ auth . Digest . UsersFile }}"
{{end}}
{{end}}
2017-12-16 16:47:03 +03:00
2018-03-26 16:32:04 +03:00
{{ $ whitelist := getWhiteList $ app . SegmentLabels }}
2018-03-23 19:40:04 +03:00
{{if $ whitelist }}
[frontends."{{ $ frontendName }}".whiteList]
sourceRange = [{{range $ whitelist . SourceRange }}
"{{.}}",
{{end}}]
useXForwardedFor = {{ $ whitelist . UseXForwardedFor }}
{{end}}
2018-03-26 16:32:04 +03:00
{{ $ redirect := getRedirect $ app . SegmentLabels }}
2018-01-10 13:58:03 +03:00
{{if $ redirect }}
[frontends."{{ $ frontendName }}".redirect]
entryPoint = "{{ $ redirect . EntryPoint }}"
regex = "{{ $ redirect . Regex }}"
replacement = "{{ $ redirect . Replacement }}"
2018-01-31 21:10:04 +03:00
permanent = {{ $ redirect . Permanent }}
2018-01-10 13:58:03 +03:00
{{end}}
2018-03-26 16:32:04 +03:00
{{ $ errorPages := getErrorPages $ app . SegmentLabels }}
2018-01-10 13:58:03 +03:00
{{if $ errorPages }}
[frontends."{{ $ frontendName }}".errors]
{{range $ pageName , $ page := $ errorPages }}
2018-03-08 00:10:04 +03:00
[frontends."{{ $ frontendName }}".errors."{{ $ pageName }}"]
2018-01-10 13:58:03 +03:00
status = [{{range $ page . Status }}
"{{.}}",
{{end}}]
2018-04-11 14:54:03 +03:00
backend = "backend{{ $ page . Backend }}"
2018-01-10 13:58:03 +03:00
query = "{{ $ page . Query }}"
2017-12-20 18:33:57 +03:00
{{end}}
{{end}}
2018-03-26 16:32:04 +03:00
{{ $ rateLimit := getRateLimit $ app . SegmentLabels }}
2018-01-10 13:58:03 +03:00
{{if $ rateLimit }}
[frontends."{{ $ frontendName }}".rateLimit]
extractorFunc = "{{ $ rateLimit . ExtractorFunc }}"
[frontends."{{ $ frontendName }}".rateLimit.rateSet]
{{ range $ limitName , $ limit := $ rateLimit . RateSet }}
2018-03-08 00:10:04 +03:00
[frontends."{{ $ frontendName }}".rateLimit.rateSet."{{ $ limitName }}"]
2018-01-10 13:58:03 +03:00
period = "{{ $ limit . Period }}"
average = {{ $ limit . Average }}
burst = {{ $ limit . Burst }}
2017-12-20 18:33:57 +03:00
{{end}}
{{end}}
2018-03-26 16:32:04 +03:00
{{ $ headers := getHeaders $ app . SegmentLabels }}
2018-01-10 13:58:03 +03:00
{{if $ headers }}
[frontends."{{ $ frontendName }}".headers]
SSLRedirect = {{ $ headers . SSLRedirect }}
SSLTemporaryRedirect = {{ $ headers . SSLTemporaryRedirect }}
SSLHost = "{{ $ headers . SSLHost }}"
2018-05-14 12:44:03 +03:00
SSLForceHost = {{ $ headers . SSLForceHost }}
2018-01-10 13:58:03 +03: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 16:24:03 +03:00
CustomBrowserXSSValue = "{{ $ headers . CustomBrowserXSSValue }}"
2018-01-10 13:58:03 +03: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 11:42:03 +03:00
2018-01-10 13:58:03 +03:00
{{if $ headers . HostsProxyHeaders }}
HostsProxyHeaders = [{{range $ headers . HostsProxyHeaders }}
"{{.}}",
{{end}}]
{{end}}
2018-01-02 11:42:03 +03:00
2018-01-10 13:58:03 +03:00
{{if $ headers . CustomRequestHeaders }}
[frontends."{{ $ frontendName }}".headers.customRequestHeaders]
{{range $k, $v := $ headers . CustomRequestHeaders }}
{{ $k}} = "{{ $v}}"
{{end}}
2017-12-16 17:36:17 +03:00
{{end}}
2018-01-02 11:42:03 +03:00
2018-01-10 13:58:03 +03:00
{{if $ headers . CustomResponseHeaders }}
[frontends."{{ $ frontendName }}".headers.customResponseHeaders]
{{range $k, $v := $ headers . CustomResponseHeaders }}
{{ $k}} = "{{ $v}}"
{{end}}
2017-12-16 17:36:17 +03:00
{{end}}
2018-01-02 11:42:03 +03:00
2018-01-10 13:58:03 +03:00
{{if $ headers . SSLProxyHeaders }}
[frontends."{{ $ frontendName }}".headers.SSLProxyHeaders]
{{range $k, $v := $ headers . SSLProxyHeaders }}
{{ $k}} = "{{ $v}}"
{{end}}
2017-12-16 17:36:17 +03:00
{{end}}
2018-01-02 11:42:03 +03:00
{{end}}
2017-12-16 17:36:17 +03:00
2018-03-26 16:32:04 +03:00
[frontends."{{ $ frontendName }}".routes."route-host{{ $ app . ID | replace "/" "-" }}{{ getSegmentNameSuffix $ app . SegmentName }}"]
rule = "{{ getFrontendRule $ app }}"
2017-12-16 16:47:03 +03:00
{{end}}