apache / apisix-java-plugin-runner

APISIX Plugin Runner in Java
https://apisix.apache.org/
Apache License 2.0
128 stars 95 forks source link

help request: ext-plugin-post-resp 如何把请求中的自定义请求头传递给第三方插件? #231

Closed 15003476628 closed 1 year ago

15003476628 commented 1 year ago

Description

业务要求: 请求头中 自定义了一个字段, user ,需要根据用户信息 修改响应体

使用的是java插件, user 这个字段如何传递给 java-plugin-run?

Environment

soulbird commented 1 year ago

Try request.getVars(http_user)

15003476628 commented 1 year ago

request.getVars(http_user) 只能获取到 nginx的默认变量请求头,例如:server_port
但是不能获取到自定义的请求头信息!

soulbird commented 1 year ago

see: http://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_

15003476628 commented 1 year ago

see: http://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_

这里面都是nginx的内置变量 没有找到我需要的!

soulbird commented 1 year ago

see: http://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_

这里面都是nginx的内置变量 没有找到我需要的!

$http_user

15003476628 commented 1 year ago

see: http://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_

这里面都是nginx的内置变量 没有找到我需要的!

$http_user

非常感谢,非常感谢! 已获取到了

xiaolajiyhy commented 1 year ago

请问是怎么获取到的