Skip to content

Commit a4bf040

Browse files
author
Matthew Fisher
committed
Merge pull request #3519 from bacongobbler/3470-use-conf-when-no-match
fix(router): include deis.conf if no match with an SSL cert
2 parents 858d244 + 1619fb3 commit a4bf040

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

router/image/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ ENV DEBIAN_FRONTEND noninteractive
55
# install common packages
66
RUN apt-get update && apt-get install -y curl net-tools sudo
77

8-
# install confd
9-
RUN curl -sSL -o /usr/local/bin/confd https://s3-us-west-2.amazonaws.com/opdemand/confd-git-b8e693c \
8+
# install confd from https://github.com/deis/confd/tree/deis
9+
RUN curl -sSL -o /usr/local/bin/confd https://s3-us-west-2.amazonaws.com/opdemand/confd-git-4c50136 \
1010
&& chmod +x /usr/local/bin/confd
1111

1212
# install common packages

router/image/templates/nginx.conf

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ http {
142142
{{ $affinityArg := .deis_router_affinityArg }}
143143
{{ $certs := .deis_certs }}
144144
{{ $domains := .deis_domains }}
145+
{{ $root := . }}
145146
{{ range $service := .deis_services }}{{ if $service.Nodes }}
146147
upstream {{ Base $service.Key }} {
147148
{{ if $affinityArg }}hash $arg_{{ $affinityArg }} consistent;
@@ -155,18 +156,26 @@ http {
155156
{{ range $domain := $domains }}{{ if eq (Base $service.Key) $domain.Value }}
156157
server {
157158
server_name {{ Base $domain.Key }};
159+
{{/* if a SSL certificate is installed for this domain, use SSL */}}
160+
{{/* NOTE (bacongobbler): domains are separate from the default platform domain, */}}
161+
{{/* so we can't rely on deis.conf as each domain is an island */}}
162+
{{/* FIXME (bacongobbler): confd turns hyphens to dashes, so we need to account */}}
163+
{{/* for that in domains */}}
164+
{{ if index $root (printf "deis_certs_%s_cert" (Replace (Base $domain.Key) "-" "_" -1)) }}
158165
server_name_in_redirect off;
159166
port_in_redirect off;
160167
listen 80;
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) }}
165168
listen 443 ssl spdy;
166169
ssl_certificate /etc/ssl/deis/certs/{{ Base $domain.Key }}.cert;
167170
ssl_certificate_key /etc/ssl/deis/keys/{{ Base $domain.Key }}.key;
168171
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
169-
{{ end }}{{ end }}
172+
{{/* if there's no app SSL cert but we have a router SSL cert, enable that instead */}}
173+
{{/* TODO (bacongobbler): wait for https://github.com/kelseyhightower/confd/issues/270 */}}
174+
{{/* so we can apply this config to just subdomains of the platform domain. */}}
175+
{{/* ref: https://github.com/deis/deis/pull/3519 */}}
176+
{{ else }}
177+
include deis.conf;
178+
{{ end }}
170179

171180
{{ if $service.Nodes }}
172181
location / {

0 commit comments

Comments
 (0)