Request Advanced Match
Prepare environment
Please refer to API7 EE Introduction to complete the environment preparation.
Create route with advanced match
Create an API, this time we don't need to open the plugin.
Set the Host and path.
Add advanced matching conditions.
Fill in the rules form.
Submit the form to create the API.
Test
Request without company in query
curl 127.0.0.1/anything -i -H "Host: example.com"
HTTP/1.1 404 Not Found
Date: Mon, 13 Mar 2023 02:20:00 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: APISIX/2.13.2304
{"error_msg":"404 Route Not Found"}
Request with company in query
curl 127.0.0.1/anything?company=100 -i -H "Host: example.com"
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 430
Connection: keep-alive
Date: Mon, 13 Mar 2023 02:24:29 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Server: APISIX/2.13.2304
{
"args": {
"company": "100"
},
"data": "",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Host": "example.com",
"User-Agent": "curl/7.81.0",
"X-Amzn-Trace-Id": "Root=1-640e895d-126e349322be72d5243a12a7",
"X-Forwarded-Host": "example.com"
},
"json": null,
"method": "GET",
"origin": "172.17.0.1, 146.190.80.65",
"url": "http://example.com/anything?company=100"
}