You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ref(router): split domains to its own custom directive
In order to support multiple certs on multiple custom domains bound to
the same application, we need to split out each custom domain to its own
`server {}` directive. In master, the domain etcd keys are set like so:
SET /deis/domains/go "www.bacongobbler.com foo.bacongobbler.com"
In confd v0.5.0, there is no way to split strings by whitespace so
there's no way to iterate through each domain bound to an application.
In this commit, there's a controller data migration script which will
migrate existing etcd keys for custom domain endpoints over to the new
syntax:
SET /deis/domains/www.bacongobbler.com "go"
SET /deis/domains/foo.bacongobbler.com "go"
Confd v0.8.0 has support for splitting strings, but with this approach
we can start providing support for migrations such as the one proposed
in #3399.
{{ range $domain := $domains}}{{if eq (Base $service.Key)$domain.Value }}
154
156
server{
155
-
server_name~^{{ Base $service.Key }}\.(?<domain>.+)${{ range $app_domains := $domains }}{{ if eq (Base $service.Key) (Base $app_domains.Key) }} {{ $app_domains.Value }}{{ end }}{{ end }};
156
-
{{ range $domain := $domains}}{{ range $cert := $certs}}
157
-
{{if eq $domain.Value (Base $cert.Key)}}
158
-
{{$useSSL := "true"}}
157
+
server_name{{ Base $domain.Key }};
159
158
server_name_in_redirect off;
160
159
port_in_redirect off;
161
160
listen80;
161
+
{{/* if a SSL certificate is installed for this domain, use SSL */}}
162
+
{{/* Note (bacongobbler): domains are separate from the default platform domain, */}}
163
+
{{/* so we can't rely on deis.conf as each domain is an island */}}
164
+
{{ range $cert := $certs}}{{if eq (Base $domain.Key)(Base $cert.Key)}}
162
165
listen443ssl spdy;
163
-
ssl_certificate /etc/ssl/deis/certs/{{ Base $cert.Key }}.cert;
164
-
ssl_certificate_key /etc/ssl/deis/keys/{{ Base $cert.Key }}.key;
166
+
ssl_certificate /etc/ssl/deis/certs/{{ Base $domain.Key }}.cert;
167
+
ssl_certificate_key /etc/ssl/deis/keys/{{ Base $domain.Key }}.key;
168
+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
169
+
{{ end }}{{ end }}
170
+
171
+
{{if$service.Nodes }}
172
+
location / {
173
+
{{if eq $useFirewall"true"}}include /opt/nginx/firewall/active-mode.rules;{{ end }}
0 commit comments