Skip to content

Commit c6c65d1

Browse files
committed
Merge pull request #3828 from dialoghq/feature/set-random-affinity
fix(router): set_random belongs in a `location` block
2 parents daa4e69 + 03c1095 commit c6c65d1

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

router/image/templates/nginx.conf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,6 @@ http {
158158
{{ $useSSL := or (getv "/deis/router/sslCert") "false" }}
159159
{{ $domains := ls "/deis/domains" }}
160160
{{ $certs := ls "/deis/certs" }}
161-
## workaround for nginx hashing empty string bug http://trac.nginx.org/nginx/ticket/765
162-
{{ if exists "/deis/router/affinityArg" }}
163-
set_random $prng 0 99;
164-
set_if_empty $arg_{{ getv "/deis/router/affinityArg" }} $prng;
165-
{{ end }}
166161
## start service definitions for each application
167162
{{ range $app := lsdir "/deis/services" }}
168163
{{ $upstreams := printf "/deis/services/%s/*" $app}}
@@ -231,6 +226,12 @@ http {
231226
}
232227
{{ end }}
233228

229+
## workaround for nginx hashing empty string bug http://trac.nginx.org/nginx/ticket/765
230+
{{ if exists "/deis/router/affinityArg" }}
231+
set_random $prng 0 99;
232+
set_if_empty $arg_{{ getv "/deis/router/affinityArg" }} $prng;
233+
{{ end }}
234+
234235
proxy_pass http://{{ $app }};
235236
}
236237
{{ else }}

0 commit comments

Comments
 (0)