request help: apisix似乎没有类似kong中strip_path这样的方法或插件
Issue description
我想在apisix中将请求的path中前一部分截取掉然后传入到上游,但是apisix中似乎只有proxy_rewrite这个插件,但是路径中往往会有'%2F'这样的转义符号,例如:http://XXX.myscrm.cn/服务名/api/projects/qweqwe%2Fqweqwe/master/files/proto%2Fsource 这样的请求,url中的"qweqwe%2Fqweqwe"这对于服务来讲其实是一种参数,而这种请求在被proxy_rewrite重写后,"%2F"就会被转义成"/",这样请求到服务后就会出问题,所以我希望能在apisix中找到类似kong中strip_path这类的方法,就是单纯的将path一部分截取掉然后传入上游,请问有这样的插件吗
Environment
Request help without environment information will be ignored or closed.
- apisix version (cmd:
apisix version):2.3
Hi @StretchV actually we are using proxy_rewrite to implement this for now. Maybe you could refer to this:
https://github.com/apache/apisix/blob/master/docs/en/latest/FAQ.md#how-to-strip-route-prefix-for-path-matching
@Yiyiyimu 你好,用regex_uri这个属性是不可以的,因为我不止是希望去掉前缀,而且我还希望path不被转义,因为我的业务中有类似http://www.XXXX.com/foo/qqqq%2Fqqqq/www,这样的请求,这种请求一被regex_uri之后,%2F就会被转义成"/",后端接受到的路径就是http://www.XXXX.com/qqqq/qqqq/www了,所以这种正则的重写方式是不可以的,所以我想问下有没有那种直接截断式的,但是我并没有在apisix中找到类似的方法
%2F has a special meaning in URL encoding, after decoding it is /.
I think you should change this uri to not contain %2F.
You'll need to implement it yourself if you truncate it directly.
好的谢谢