The matching rules of the API listening paths in Tyk

Hi,我想了解下路径的匹配规则,我的监听路径设置的是/test-outer,为什么我访问/test-outer2,或者/test-outer2233也能匹配上呢?如何杜绝这个问题呢?下面是我的API配置:

“proxy”: {
“preserve_host_header”: false,
“listen_path”: “/test-outer”,
“target_url”: “https://2024.ipchaxun.com/”,
“disable_strip_slash”: false,
“strip_listen_path”: true,
“enable_load_balancing”: false,
“target_list”: null,
“check_host_against_uptime_tests”: false,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“port_data_path”: “”,
“target_path”: “”,
“use_target_list”: false,
“cache_timeout”: 0,
“endpoint_returns_list”: false
}

Tyk 的默认设置把监听路径当成regex。因为nearest neighbor,所以虽然设置为/test-outer,你能配上/test-outer2。
为了防止这种泄露行为,在Tyk网关里设置TYK_GW_HTTPSERVEROPTIONS_ENABLESTRICTROUTES=true再把Tyk网关重启。

谢谢你的回答,我刚在项目里搜索了,没有搜到,我用的开源的Tyk GW v4.1.0,请问应该在哪里设置关闭呢?

在tyk.conf里可以设置。Tyk版本现在v5.x了,有否可以考虑升级?
https://tyk.io/docs/tyk-oss-gateway/configuration/#http_server_optionsenable_strict_routes

个性化修改的内容太多了,暂不升级了,谢谢你。