3636 client_max_body_size {{ or ( .deis_router_bodySize) "1m" }} ;
3737
3838 log_format upstreaminfo '[$time_local] - $remote_addr - $remote_user - $status - "$request" - $bytes_sent - "$http_referer" - "$http_user_agent" - "$server_name" - $upstream_addr' ;
39-
39+
4040 # send logs to STDOUT so they can be seen using 'docker logs'
4141 access_log /opt/nginx/logs/access.log upstreaminfo;
4242 error_log /opt/nginx/logs/error.log;
@@ -51,11 +51,13 @@ http {
5151 upstream deis-controller {
5252 server {{ .deis_controller_host }} :{{ .deis_controller_port }} ;
5353 }
54+ {{ end }}
5455
5556 server {
5657 server_name ~ ^deis\.( ?<domain>.+) $;
5758 include deis.conf;
5859
60+ {{ if .deis_controller_host }}
5961 location / {
6062 proxy_buffering off;
6163 proxy_set_header Host $host ;
@@ -67,21 +69,28 @@ http {
6769
6870 proxy_pass http ://deis-controller;
6971 }
70- }{{ end }}
72+ {{ else }}
73+ location / {
74+ return 503 ;
75+ }
76+ {{ end }}
77+ }
7178 ## end deis-controller
7279
7380 ## start deis-store-gateway
7481 {{ if .deis_store_gateway_host }}
7582 upstream deis-store-gateway {
7683 server {{ .deis_store_gateway_host }} :{{ .deis_store_gateway_port }} ;
7784 }
85+ {{ end }}
7886
7987 server {
8088 server_name ~ ^deis-store\.( ?<domain>.+) $;
8189 include deis.conf;
8290
8391 client_max_body_size 0;
8492
93+ {{ if .deis_store_gateway_host }}
8594 location / {
8695 proxy_buffering off;
8796 proxy_set_header Host $host ;
@@ -93,7 +102,12 @@ http {
93102
94103 proxy_pass http ://deis-store-gateway;
95104 }
96- }{{ end }}
105+ {{ else }}
106+ location / {
107+ return 503 ;
108+ }
109+ {{ end }}
110+ }
97111 ## end deis-store-gateway
98112
99113 ## start service definitions for each application
@@ -103,11 +117,13 @@ http {
103117 {{ range $upstream := $service .Nodes }} server {{ $upstream .Value }} ;
104118 {{ end }}
105119 }
120+ {{ end }}
106121
107122 server {
108123 server_name ~ ^{{ Base $service .Key }} \.(?<domain>.+)${{ range $app_domains := $domains }}{{ if eq (Base $service.Key) (Base $app_domains.Key) }} {{ $app_domains.Value }}{{ end }}{{ end }} ;
109124 include deis.conf;
110125
126+ {{ if $service .Nodes }}
111127 location / {
112128 proxy_buffering off;
113129 proxy_set_header Host $host ;
@@ -129,8 +145,13 @@ http {
129145
130146 proxy_pass http ://{{ Base $service .Key }} ;
131147 }
148+ {{ else }}
149+ location / {
150+ return 503 ;
151+ }
152+ {{ end }}
132153 }
133- {{ end }}{{ end }}
154+ {{ end }}
134155 ## end service definitions for each application
135156
136157 # healthcheck
0 commit comments