qwzhou89 commented on issue #9928:
URL: https://github.com/apache/apisix/issues/9928#issuecomment-1659767143
This can be achieved by combining several plugins, such as the following:
```yaml
uri: /internal-check
plugins:
response-rewrite:
headers:
X-Api1-Status: '$status'
status_code: 200
proxy-rewrite:
uri: "/api1",
upstream:
nodes:
- host: apisix
port: 80
weight: 1
type: roundrobin
status: 1
---
uri: /testTrafficSplit
host: apisix
plugins:
forward-auth:
upstream_headers:
- X-Api1-Status
uri: http://127.0.0.1/internal-check
serverless-pre-function:
functions:
- |
local core = require('apisix.core');
return function(conf, ctx)
if ctx.var.http_x_api1_status == '200' then
ctx.var.upstream_uri = '/api2'
elseif ctx.var.http_x_api1_status == '400' then
ctx.var.upstream_uri = '/api3'
end
end
phase: before_proxy
upstream:
nodes:
- host: apisix
port: 80
weight: 1
type: roundrobin
status: 1
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]