You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/10/18 10:00:38 UTC
[GitHub] [apisix-java-plugin-runner] savingrun opened a new issue, #204: Some questions about `upstreamHeaders` acquisition
savingrun opened a new issue, #204:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/204
### Issue description
The `postFilter` has taken effect, but now I encounter another problem, that is, the `token` in the `request` of the `client` cannot be obtained in the `upstreamHeaders`. I wonder if I understand it wrong?
**request parameters:**
``` shell
curl --location --request GET 'http://10.0.10.165/boom-center-user-service/test/leaf' \
--header 'tenant-id: 1' \
--header 'Member-Token: BOOMeyJ0eXBlIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiJCT09NIiwiaWF0IjoxNjY1NTQ1MzY2LCJwbGF0Zm9ybSI6MSwiYXZhdGFyIjoicyIsIkFDQ09VTlRfSUQiOjE0NjI2ODY3ODgwNTEyNjc1ODUsImlkIjoxNTYwODczNjA2MDE4MjM2NDE3LCJuYW1lIjoicyIsImV4cCI6MTMwNTE0NTY0MTg2fQ.waaLOKbByRStWme9K8sHBPTIejSC84Hh9dNIGxXlKlw'
```
**filter code:**
``` java
@Override
public void postFilter(PostRequest request, PostResponse response, PluginFilterChain chain) {
Map<String, String> upstreamHeaders = request.getUpstreamHeaders();
log.debug("postFilter test: upstreamHeaders {}", JSONUtil.toJsonStr(upstreamHeaders));
log.debug("postFilter test: response {}", JSONUtil.toJsonStr(response));
response.setHeader("new-token", "savingrun");
chain.postFilter(request, response);
}
```
**log:**
``` shell
2022/10/18 16:03:26 [warn] 14817#14817: *3556373 [lua] init.lua:913: 2022-10-18 16:03:26.695 DEBUG 14822 --- [ntLoopGroup-2-3] c.b.a.f.AuthGlobalFilter : postFilter test: upstreamHeaders {"Transfer-Encoding":"chunked","Keep-Alive":"timeout=3","Connection":"keep-alive","Date":"Tue, 18 Oct 2022 08:03:18 GMT","Content-Type":"application/json"}
2022-10-18 16:03:26.695 DEBUG 14822 --- [ntLoopGroup-2-3] c.b.a.f.AuthGlobalFilter : postFilter test: response {}
2022-10-18 16:03:26.695 DEBUG 14822 --- [ntLoopGroup-2-3] i.n.h.l.LoggingHandler : [id: 0x98af5762] WRITE: 92B
```
### Environment
- apisix-java-plugin-runner version v0.3.0
- apisix version v2.15
--
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: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-java-plugin-runner] savingrun commented on issue #204: Some questions about `upstreamHeaders` acquisition
Posted by GitBox <gi...@apache.org>.
savingrun commented on issue #204:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/204#issuecomment-1285077780
@tzssangglass
Thank you for your patience. I use `beforeBodyWrite` to process the upstream response and return the `token` response, so that APISIX can get it
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-java-plugin-runner] tzssangglass commented on issue #204: Some questions about `upstreamHeaders` acquisition
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #204:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/204#issuecomment-1282392639
if you mean `Member-Token` , it is headers of client request headers, not upstream headers, client request headers only can be fetched in filter by `request.getHeaders`
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix-java-plugin-runner] savingrun closed issue #204: Some questions about `upstreamHeaders` acquisition
Posted by GitBox <gi...@apache.org>.
savingrun closed issue #204: Some questions about `upstreamHeaders` acquisition
URL: https://github.com/apache/apisix-java-plugin-runner/issues/204
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org