Commit d7e4572
committed
Set target_frontend after handling the disco response
When the processing of the request micro-services is finished, the
context is switched from the frontend to the backend. At that point
target_frontend is needed to set the state of the router. The router
state will be used when the processing of the response by the response
micro-services is finished, to find the appropriate frontend instance.
---
The routing state is set at the point when the switch from the frontend
(and request micro-service processing) is made towards the backend. If
the discovery response was not intercepted by the DiscoToTargetIssuer
micro-service, and instead was processed by the backend's disco-response
handler, the target_frontend would not be needed, as the routing state
would have already been set.
When the DiscoToTargetIssuer micro-service intercepts the response, the
point when the switch from the frontend to the backend happens will be
executed again. Due to leaving the proxy, going to the discovery service
and coming back to the proxy, context.target_frontend has been lost.
Only the state stored within context.state persists (through the
cookie).
---
When the request micro-services finish processing the request,
backend_routing is called, which sets the router state
(context.state['ROUTER']) to target_frontend, and returns the
appropriate backend instance based on target_backend. When the time
comes to switch from the backend to the frontend, that state is looked
up (see below).
When the response micro-services finish processing the response,
frontend_routing is called, which sets target_frontend from the router
state (context.state['ROUTER']) and returns the appropriate frontend
instance based on target_frontend.
---
Signed-off-by: Ivan Kanakarakis <[email protected]>1 parent c0265f2 commit d7e4572
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
| 55 | + | |
| 56 | + | |
47 | 57 | | |
48 | 58 | | |
0 commit comments