endison1986 commented on issue #7082:
URL: https://github.com/apache/apisix/issues/7082#issuecomment-1131449164
`OPTIONS` is already in Route, but OPTIONS request without env responds with
404 due to adding advanced match condition `env=dev`.
I use HTTP request headers to distinguish different environments in the same
context, but if OPTIONS cannot carry custom request headers, then I have to be
careful with advanced match conditions?
Because this will cause APISIX to not be able to correctly distinguish the
request target`OPTIONS`已经在Route中,但是由于添加了高级匹配条件`env=dev`导致没有env的OPTIONS请求响应了404.
我使用HTTP请求头在相同的上下文下区分不同的环境,但如果OPTIONS无法携带自定义请求头,那我不得不谨慎使用高级匹配条件?
因为这样将导致APISIX无法正确的分辨请求目标
------------------------------------------------------------------------------------------
I have an idea, I use APISIX+NACOS to discover services in my microservice
environment, dev is actually the namespace in NACOS, the current namespace is
fixed, if namesapce can pass the env in the HTTP request header as a parameter,
Then I don't need to match different routes through env, so the number of
routes is also reduced, and there is no need to configure a route for a
namespace separately.
我有一个想法,我使用APISIX+NACOS在我的微服务环境中发现服务,dev实际上是NACOS中的namespace,目前的namespace是固定的,如果namesapce可以通过HTTP请求头中的env作为参数的话,那我就不需要通过env来匹配不同的路由了,这样路由的数量也变少了,不需要单独为一个namespace配置一个路由了
For example, configure like this:
比如象这样配置:
```json
{
"timeout": {
"connect": 30,
"send": 30,
"read": 30
},
"type": "roundrobin",
"scheme": "http",
"discovery_type": "nacos",
"discovery_args": {
"group_name": "DEFAULT_GROUP",
"namespace_id": "${headers.env}"
},
"pass_host": "pass",
"name": "user",
"service_name": "user",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
}
}
```
--
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]