Skip to content

Commit

Permalink
Merge pull request deis#3828 from dialoghq/feature/set-random-affinity
Browse files Browse the repository at this point in the history
fix(router): set_random belongs in a `location` block
  • Loading branch information
mboersma committed Jun 9, 2015
2 parents daa4e69 + 03c1095 commit c6c65d1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions router/image/templates/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ http {
{{ $useSSL := or (getv "/deis/router/sslCert") "false" }}
{{ $domains := ls "/deis/domains" }}
{{ $certs := ls "/deis/certs" }}
## workaround for nginx hashing empty string bug http://trac.nginx.org/nginx/ticket/765
{{ if exists "/deis/router/affinityArg" }}
set_random $prng 0 99;
set_if_empty $arg_{{ getv "/deis/router/affinityArg" }} $prng;
{{ end }}
## start service definitions for each application
{{ range $app := lsdir "/deis/services" }}
{{ $upstreams := printf "/deis/services/%s/*" $app}}
Expand Down Expand Up @@ -231,6 +226,12 @@ http {
}
{{ end }}

## workaround for nginx hashing empty string bug http://trac.nginx.org/nginx/ticket/765
{{ if exists "/deis/router/affinityArg" }}
set_random $prng 0 99;
set_if_empty $arg_{{ getv "/deis/router/affinityArg" }} $prng;
{{ end }}

proxy_pass http://{{ $app }};
}
{{ else }}
Expand Down

0 comments on commit c6c65d1

Please sign in to comment.