File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ map $http_upgrade $connection_upgrade {
17
17
'' close;
18
18
}
19
19
20
+ # this allows us to override the upstream based on a cookie called `route_override`
21
+ map $cookie_route_override $upstream_override {
22
+ default $split_upstream;
23
+ monolith _monolith;
24
+ balancer _balancer;
25
+ }
26
+
20
27
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=1000m inactive=600m;
21
28
22
29
server {
@@ -25,7 +32,7 @@ server {
25
32
http2 on;
26
33
27
34
location / {
28
- proxy_pass http://$split_upstream $request_uri;
35
+ proxy_pass http://$upstream_override $request_uri;
29
36
proxy_http_version 1.1;
30
37
proxy_set_header Upgrade $http_upgrade;
31
38
proxy_set_header Connection "upgrade";
@@ -42,5 +49,7 @@ server {
42
49
proxy_send_timeout 7d;
43
50
44
51
proxy_socket_keepalive on;
52
+
53
+ add_header X-Upstream $upstream_override;
45
54
}
46
55
}
You can’t perform that action at this time.
0 commit comments