apollo
apollo copied to clipboard
通过Apollo open API操作key中包含“/”的配置,操作失败
原因:
- client 中代码:String path =
String.format("envs/%s/apps/%s/clusters/%s/namespaces/%s/items/%s", escapePath(env), escapePath(appId), escapePath(clusterName), escapePath(namespaceName), escapePath(itemDTO.getKey()));
对key进行了转义; - server 中代码:没有进行转义; 现象就是:获取配置、更新配置、删除配置报错。
这个和服务端没有转义没有关系,在tomcat这一层就拦截了,详见org.apache.tomcat.util.buf. UDecoder.ALLOW_ENCODED_SLASH。
另外spring security默认也会阻止这类参数,详见setAllowUrlEncodedSlash
那我们是否考虑换一种请求参数传递方式,不使用这种path variable
技术上是可以的,不过改接口的话,得考虑下向后兼容的问题,另外想问下什么样配置项是包含/
的?
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
我们有一些配置是针对前端接口的配置,配置的key的一部分是URL,比如:route.map./get/user/info
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
遇到了同样的问题 如果通过yaml文件可以在bootstrap.yml定义成
openapi:
allow:
$[/sample-apollo/openapi/test]: ['10.10.21.43']
但是移动到apollo里面,并且改成了properties,就不会生效了,请问有什么好的办法可以解决?
谢谢
后面测试, 可以通过
openapi.allow."[/sample-apollo/openapi/test]"[0] = 127.0.0.1
openapi.allow."[/sample-apollo/openapi/test]"[1] = 127.0.0.2
方式进行设置。
@dragontree101 你好。请问这个设置方法具体怎么操作?用api操作怎么填参数?
@dragontree101 你好。请问这个设置方法具体怎么操作?用api操作怎么填参数?
你好, 我们是在apollo后台配置进行操作的, 没有用过apollo的api进行参数设置
不考虑添加接口吗,因为界面上是可以设置key包含斜杆的
这个问题还在跟进吗?