@@ -109,36 +109,15 @@ frontend public
109
109
acl secure_redirect base,map_beg(/var/lib/haproxy/conf/os_edge_http_redirect.map) -m found
110
110
redirect scheme https if secure_redirect
111
111
112
- {{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
113
- # Check for wildcard domains with redirected http routes.
114
- acl wildcard_domain hdr(host),map_reg(/var/lib/haproxy/conf/os_wildcard_domain.map) -m found
115
-
116
- acl wildcard_secure_redirect base,map_reg(/var/lib/haproxy/conf/os_edge_http_redirect.map) -m found
117
- redirect scheme https if wildcard_domain wildcard_secure_redirect
118
-
119
- {{ end }}
120
-
121
112
# Check if it is an edge route exposed insecurely.
122
113
acl edge_http_expose base,map_beg(/var/lib/haproxy/conf/os_edge_http_expose.map) -m found
123
114
use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_expose.map)] if edge_http_expose
124
115
125
- # map to http backend
126
- # Search from most specific to general path (host case).
127
- acl http_backend base,map_beg(/var/lib/haproxy/conf/os_http_be.map) -m found
128
- use_backend be_http_%[base,map_beg(/var/lib/haproxy/conf/os_http_be.map)] if http_backend
129
-
130
- {{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
131
- # Check for wildcard domains with exposed http routes.
132
- acl wildcard_edge_http_expose base,map_reg(/var/lib/haproxy/conf/os_edge_http_expose.map) -m found
133
- use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_expose.map)] if wildcard_domain wildcard_edge_http_expose
134
-
135
116
# map to http backend
136
117
# Search from most specific to general path (host case).
137
118
# Note: If no match, haproxy uses the default_backend, no other
138
119
# use_backend directives below this will be processed.
139
- use_backend be_http_%[base,map_reg(/var/lib/haproxy/conf/os_http_be.map)] if wildcard_domain
140
-
141
- {{ end }}
120
+ use_backend be_http_%[base,map_beg(/var/lib/haproxy/conf/os_http_be.map)]
142
121
143
122
default_backend openshift_default
144
123
@@ -155,15 +134,6 @@ frontend public_ssl
155
134
acl sni_passthrough req.ssl_sni,map(/var/lib/haproxy/conf/os_sni_passthrough.map) -m found
156
135
use_backend be_tcp_%[req.ssl_sni,map(/var/lib/haproxy/conf/os_tcp_be.map)] if sni sni_passthrough
157
136
158
- {{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
159
- # Check for wildcard domains with passthrough.
160
- acl sni_wildcard_domain req.ssl_sni,map_reg(/var/lib/haproxy/conf/os_wildcard_domain.map) -m found
161
-
162
- acl sni_wildcard_passthrough req.ssl_sni,map_reg(/var/lib/haproxy/conf/os_sni_passthrough.map) -m found
163
- use_backend be_tcp_%[req.ssl_sni,map_reg(/var/lib/haproxy/conf/os_tcp_be.map)] if sni sni_wildcard_domain sni_wildcard_passthrough
164
-
165
- {{ end }}
166
-
167
137
# if the route is SNI and NOT passthrough enter the termination flow
168
138
use_backend be_sni if sni
169
139
@@ -199,25 +169,11 @@ frontend fe_sni
199
169
# Search from most specific to general path (host case).
200
170
use_backend be_secure_%[base,map_beg(/var/lib/haproxy/conf/os_reencrypt.map)] if reencrypt
201
171
202
- # map to http backend
203
- # Search from most specific to general path (host case).
204
- acl http_backend base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map) -m found
205
- use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map)] if http_backend
206
-
207
- {{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
208
- # Check for wildcard domains with redirected or exposed http routes.
209
- acl sni_wildcard_domain hdr(host),map_reg(/var/lib/haproxy/conf/os_wildcard_domain.map) -m found
210
-
211
- acl wildcard_reencrypt base,map_reg(/var/lib/haproxy/conf/os_reencrypt.map) -m found
212
- use_backend be_secure_%[base,map_reg(/var/lib/haproxy/conf/os_reencrypt.map)] if sni_wildcard_domain wildcard_reencrypt
213
-
214
172
# map to http backend
215
173
# Search from most specific to general path (host case).
216
174
# Note: If no match, haproxy uses the default_backend, no other
217
175
# use_backend directives below this will be processed.
218
- use_backend be_edge_http_%[base,map_reg(/var/lib/haproxy/conf/os_edge_http_be.map)] if sni_wildcard_domain
219
-
220
- {{ end }}
176
+ use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map)]
221
177
222
178
default_backend openshift_default
223
179
@@ -250,24 +206,11 @@ frontend fe_no_sni
250
206
# Search from most specific to general path (host case).
251
207
use_backend be_secure_%[base,map_beg(/var/lib/haproxy/conf/os_reencrypt.map)] if reencrypt
252
208
253
- # map to http backend
254
- # Search from most specific to general path (host case).
255
- acl edge_http_backend base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map) -m found
256
- use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map)] if edge_http_backend
257
-
258
- {{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
259
- acl host_wildcard_domain req.ssl_sni,map_reg(/var/lib/haproxy/conf/os_wildcard_domain.map) -m found
260
-
261
- acl host_reencrypt base,map_reg(/var/lib/haproxy/conf/os_reencrypt.map) -m found
262
- use_backend be_secure_%[base,map_reg(/var/lib/haproxy/conf/os_reencrypt.map)] if host_wildcard_domain host_reencrypt
263
-
264
209
# map to http backend
265
210
# Search from most specific to general path (host case).
266
211
# Note: If no match, haproxy uses the default_backend, no other
267
212
# use_backend directives below this will be processed.
268
- use_backend be_edge_http_%[base,map_reg(/var/lib/haproxy/conf/os_edge_http_be.map)] if host_wildcard_domain
269
-
270
- {{ end }}
213
+ use_backend be_edge_http_%[base,map_beg(/var/lib/haproxy/conf/os_edge_http_be.map)]
271
214
272
215
default_backend openshift_default
273
216
@@ -387,8 +330,8 @@ backend be_edge_http_{{$cfgIdx}}
387
330
{{ end }}{{/* end iterate over services */}}
388
331
{{ end }}{{/* end if tls==edge/none */}}
389
332
390
- {{ if eq $cfg.TLSTermination "passthrough" }}
391
333
# Secure backend, pass through
334
+ {{ if eq $cfg.TLSTermination "passthrough" }}
392
335
backend be_tcp_{{$cfgIdx}}
393
336
{{ if ne (env "ROUTER_SYSLOG_ADDRESS" "") ""}}
394
337
option tcplog
@@ -451,8 +394,8 @@ backend be_tcp_{{$cfgIdx}}
451
394
{{ end }}{{/* end iterate over services*/}}
452
395
{{ end }}{{/*end tls==passthrough*/}}
453
396
454
- {{ if eq $cfg.TLSTermination "reencrypt" }}
455
397
# Secure backend which requires re-encryption
398
+ {{ if eq $cfg.TLSTermination "reencrypt" }}
456
399
backend be_secure_{{$cfgIdx}}
457
400
mode http
458
401
option redispatch
@@ -528,35 +471,14 @@ backend be_secure_{{$cfgIdx}}
528
471
{{ end }}{{/* end haproxy config template */}}
529
472
530
473
{{/*--------------------------------- END OF HAPROXY CONFIG, BELOW ARE MAPPING FILES ------------------------*/}}
531
- {{/*
532
- os_wildcard_domain.map: contains a mapping of wildcard hosts for a
533
- [sub]domain regexps. This map is used to check if
534
- a host matches a [sub]domain with has wildcard support.
535
- */}}
536
- {{ define "/var/lib/haproxy/conf/os_wildcard_domain.map" }}
537
- {{ if matchPattern "true|TRUE" (env "ROUTER_ALLOW_WILDCARD_ROUTES" "")}}
538
- {{ range $idx, $cfg := .State }}
539
- {{ if ne $cfg.Host ""}}
540
- {{ if $cfg.IsWildcard }}
541
- {{genDomainWildcardRegexp $cfg.Host "" true}} 1
542
- {{ end }}
543
- {{ end }}
544
- {{ end }}
545
- {{ end }}{{/* end if router allows wildcard routes */}}
546
- {{ end }}{{/* end wildcard domain map template */}}
547
-
548
474
{{/*
549
475
os_http_be.map: contains a mapping of www.example.com -> <service name>. This map is used to discover the correct backend
550
476
by attaching a prefix (be_http_) by use_backend statements if acls are matched.
551
477
*/}}
552
478
{{ define "/var/lib/haproxy/conf/os_http_be.map" }}
553
479
{{ range $idx, $cfg := .State }}
554
480
{{ if and (ne $cfg.Host "") (eq $cfg.TLSTermination "")}}
555
- {{ if $cfg.IsWildcard }}
556
- {{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
557
- {{ else }}
558
481
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
559
- {{ end }}
560
482
{{ end }}
561
483
{{ end }}
562
484
{{ end }}{{/* end http host map template */}}
@@ -568,11 +490,7 @@ backend be_secure_{{$cfgIdx}}
568
490
{{ define "/var/lib/haproxy/conf/os_edge_http_be.map" }}
569
491
{{ range $idx, $cfg := .State }}
570
492
{{ if and (ne $cfg.Host "") (eq $cfg.TLSTermination "edge")}}
571
- {{ if $cfg.IsWildcard }}
572
- {{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
573
- {{ else }}
574
493
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
575
- {{ end }}
576
494
{{ end }}
577
495
{{ end }}
578
496
{{ end }}{{/* end edge http host map template */}}
@@ -585,11 +503,7 @@ backend be_secure_{{$cfgIdx}}
585
503
{{ define "/var/lib/haproxy/conf/os_edge_http_expose.map" }}
586
504
{{ range $idx, $cfg := .State }}
587
505
{{ if and (ne $cfg.Host "") (and (eq $cfg.TLSTermination "edge") (eq $cfg.InsecureEdgeTerminationPolicy "Allow"))}}
588
- {{ if $cfg.IsWildcard }}
589
- {{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
590
- {{ else }}
591
506
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
592
- {{ end }}
593
507
{{ end }}
594
508
{{ end }}
595
509
{{ end }}{{/* end edge insecure expose http host map template */}}
@@ -602,11 +516,7 @@ backend be_secure_{{$cfgIdx}}
602
516
{{ define "/var/lib/haproxy/conf/os_edge_http_redirect.map" }}
603
517
{{ range $idx, $cfg := .State }}
604
518
{{ if and (ne $cfg.Host "") (and (eq $cfg.TLSTermination "edge") (eq $cfg.InsecureEdgeTerminationPolicy "Redirect"))}}
605
- {{ if $cfg.IsWildcard }}
606
- {{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
607
- {{ else }}
608
519
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
609
- {{ end }}
610
520
{{ end }}
611
521
{{ end }}
612
522
{{ end }}{{/* end edge insecure redirect http host map template */}}
@@ -619,11 +529,7 @@ backend be_secure_{{$cfgIdx}}
619
529
{{ define "/var/lib/haproxy/conf/os_tcp_be.map" }}
620
530
{{ range $idx, $cfg := .State }}
621
531
{{ if and (eq $cfg.Path "") (and (ne $cfg.Host "") (or (eq $cfg.TLSTermination "passthrough") (eq $cfg.TLSTermination "reencrypt"))) }}
622
- {{ if $cfg.IsWildcard }}
623
- {{genDomainWildcardRegexp $cfg.Host "" true}} {{$idx}}
624
- {{ else }}
625
532
{{$cfg.Host}} {{$idx}}
626
- {{ end }}
627
533
{{ end }}
628
534
{{ end }}
629
535
{{ end }}{{/* end tcp host map template */}}
@@ -635,11 +541,7 @@ backend be_secure_{{$cfgIdx}}
635
541
{{ define "/var/lib/haproxy/conf/os_sni_passthrough.map" }}
636
542
{{ range $idx, $cfg := .State }}
637
543
{{ if and (eq $cfg.Path "") (eq $cfg.TLSTermination "passthrough") }}
638
- {{ if $cfg.IsWildcard }}
639
- {{genDomainWildcardRegexp $cfg.Host "" true}} {{$idx}}
640
- {{ else }}
641
544
{{$cfg.Host}} 1
642
- {{ end }}
643
545
{{ end }}
644
546
{{ end }}
645
547
{{ end }}{{/* end sni passthrough map template */}}
@@ -652,11 +554,7 @@ backend be_secure_{{$cfgIdx}}
652
554
{{ define "/var/lib/haproxy/conf/os_reencrypt.map" }}
653
555
{{ range $idx, $cfg := .State }}
654
556
{{ if and (ne $cfg.Host "") (eq $cfg.TLSTermination "reencrypt") }}
655
- {{ if $cfg.IsWildcard }}
656
- {{genDomainWildcardRegexp $cfg.Host $cfg.Path false}} {{$idx}}
657
- {{ else }}
658
557
{{$cfg.Host}}{{$cfg.Path}} {{$idx}}
659
- {{ end }}
660
558
{{ end }}
661
559
{{ end }}
662
560
{{ end }}{{/* end reencrypt map template */}}
0 commit comments