tzssangglass commented on issue #219:
URL:
https://github.com/apache/apisix-java-plugin-runner/issues/219#issuecomment-1341872721
I can't reproduce your problem.
filter:
```java
package com.example.demo;
import org.apache.apisix.plugin.runner.HttpRequest;
import org.apache.apisix.plugin.runner.HttpResponse;
import org.apache.apisix.plugin.runner.filter.PluginFilter;
import org.apache.apisix.plugin.runner.filter.PluginFilterChain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class DemoFilter implements PluginFilter {
private final Logger logger = LoggerFactory.getLogger(DemoFilter.class);
@Override
public String name() {
return "DemoFilter";
}
@Override
public void filter(HttpRequest request, HttpResponse response,
PluginFilterChain chain) {
logger.warn("DemoFilter is running");
request.setHeader("X-APISIX-Plugin-Runner", "0.4.0");
chain.filter(request, response);
}
}
```
route:
```shell
curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/get",
"plugins": {
"ext-plugin-pre-req": {
"conf" : [
{"name": "DemoFilter", "value": "{\"enable\":\"feature\"}"}
]
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'
```
test:
```shell
curl http://127.0.0.1:9080/get
{
"args": {},
"headers": {
"Accept": "*/*",
"Host": "127.0.0.1",
"User-Agent": "curl/7.79.1",
"X-Apisix-Plugin-Runner": "0.4.0",
"X-Forwarded-Host": "127.0.0.1"
},
"origin": "127.0.0.1, 103.116.72.14",
"url": "http://127.0.0.1/get"
}
```
you can see: `"X-Apisix-Plugin-Runner": "0.4.0"` that upstream receive
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]