request help: The plugin configuration is not taking effect after running Docker.
hfguo02 opened this issue · 2 comments
hfguo02 commented
Issue description
🔍After building the image and running it, the log shows that Spring Boot starts successfully. I configured the "ext-plugin-pre" in the routing, but it is not taking effect. There are no prompts or exceptions.
ℹ️Response log:172.17.0.1 - - [07/Sep/2023:10:54:27 +0000] 127.0.0.1:9080 "GET /mock HTTP/1.1" 200 7 0.055 "-" "PostmanRuntime/7.32.3" 192.168.10.78:9689 200 0.003 "http://127.0.0.1:9080"
ps:If possible, could you also tell me how to achieve plugin hot deployment using this project? Thank you.🤗
version
- apisix 3.4.1
- apisix-java-plugin-runner 0.4.0
Dockerfile
FROM apache/apisix:3.4.1-debian
RUN apt-get update && apt-get -y --fix-missing install openjdk-11-jdk
ADD apache-apisix-java-plugin-runner-0.4.0-bin.tar.gz /usr/local/
docker image log
2023-09-07 18:46:45 /usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init
2023-09-07 18:46:45 /usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init_etcd
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 50#50: *1 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 49#49: *2 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 51#51: *3 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 54#54: *7 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 53#53: *5 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 52#52: *4 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 55#55: *6 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 58#58: *8 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 49#49: *2 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 51#51: *3 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 55#55: *6 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 50#50: *1 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 53#53: *5 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 52#52: *4 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 54#54: *7 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 51#51: *23 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 49#49: *48 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 66#66: *9 [lua] plugin.lua:202: load(): new plugins: {"elasticsearch-logger":true,"consumer-restriction":true,"limit-req":true,"proxy-rewrite":true,"workflow":true,"sls-logger":true,"ext-plugin-post-resp":true,"referer-restriction":true,"request-validation":true,"kafka-logger":true,"degraphql":true,"skywalking-logger":true,"grpc-transcode":true,"datadog":true,"client-control":true,"authz-keycloak":true,"mocking":true,"forward-auth":true,"limit-count":true,"basic-auth":true,"loki-logger":true,"csrf":true,"authz-casdoor":true,"serverless-post-function":true,"echo":true,"real-ip":true,"public-api":true,"gzip":true,"ip-restriction":true,"example-plugin":true,"ext-plugin-pre-req":true,"proxy-mirror":true,"cas-auth":true,"openid-connect":true,"proxy-cache":true,"uri-blocker":true,"authz-casbin":true,"ext-plugin-post-req":true,"ua-restriction":true,"serverless-pre-function":true,"api-breaker":true,"openwhisk":true,"opa":true,"azure-functions":true,"tencent-cloud-cls":true,"inspect":true,"tcp-logger":true,"aws-lambda":true,"clickhouse-logger":true,"rocketmq-logger":true,"file-logger":true,"splunk-hec-logging":true,"udp-logger":true,"google-cloud-logging":true,"zipkin":true,"syslog":true,"server-info":true,"limit-conn":true,"openfunction":true,"request-id":true,"prometheus":true,"grpc-web":true,"redirect":true,"response-rewrite":true,"cors":true,"hmac-auth":true,"wolf-rbac":true,"ldap-auth":true,"jwt-auth":true,"key-auth":true,"body-transformer":true,"kafka-proxy":true,"proxy-control":true,"loggly":true,"ai":true,"http-logger":true,"traffic-split":true,"fault-injection":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 58#58: *8 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 55#55: *65 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 50#50: *82 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 52#52: *99 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 53#53: *115 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 54#54: *130 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 58#58: *149 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 66#66: *9 [lua] plugin.lua:252: load_stream(): new plugins: {"ip-restriction":true,"syslog":true,"mqtt-proxy":true,"limit-conn":true}, context: init_worker_by_lua*
2023-09-07 18:46:45 2023/09/07 10:46:45 [warn] 66#66: *167 [lua] config_etcd.lua:168: main etcd watcher started, revision=137, context: ngx.timer
2023-09-07 18:46:46 2023/09/07 10:46:46 [warn] 66#66: *166 [lua] init.lua:953:
2023-09-07 18:46:46 , context: ngx.timer
2023-09-07 18:46:46 2023/09/07 10:46:46 [warn] 66#66: *166 [lua] init.lua:953: . ____ _ __ _ _
2023-09-07 18:46:46 /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2023-09-07 18:46:46 ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2023-09-07 18:46:46 \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2023-09-07 18:46:46 ' |____| .__|_| |_|_| |_\__, | / / / /
2023-09-07 18:46:46 =========|_|==============|___/=/_/_/_/
2023-09-07 18:46:46 , context: ngx.timer
2023-09-07 18:46:46 2023/09/07 10:46:46 [warn] 66#66: *166 [lua] init.lua:953: :: Spring Boot :: (v2.6.8)
2023-09-07 18:46:46 , context: ngx.timer
2023-09-07 18:46:46 2023/09/07 10:46:46 [warn] 66#66: *166 [lua] init.lua:953:
2023-09-07 18:46:46 , context: ngx.timer
apisix-config
deployment:
role: traditional
role_traditional:
config_provider: etcd
admin:
admin_key:
- name: admin
key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please update it when you deploy to production environment
role: admin
ext-plugin:
path_for_test: /tmp/runner.sock
cmd: ['java', '-jar', '-Xmx4g', '-Xms4g', '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']
router config
{
"uri": "/*",
"name": "hello",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"plugins": {
"ext-plugin-pre-req": {
"conf": [
{
"name": "TokenValidatorFilter",
"value": "var"
}
]
}
},
"service_id": "477375130750681791",
"upstream_id": "477375176216937151",
"status": 1
}
hfguo02 commented
ext-plugin
@Slf4j
@Component
public class TokenValidatorFilter implements PluginFilter {
@Override
public String name() {
return "TokenValidatorFilter";
}
@Override
public void filter(HttpRequest request, HttpResponse response, PluginFilterChain chain) {
log.info(" request info :{}", request.toString());
String path = request.getPath();
if ("mock".contains(path)) {
response.setBody("request fail!");
return;
}
chain.filter(request, response);
}
}
hfguo02 commented
Confirm successful plugin startup through the following files.
java-runner-common-default.log
2023-09-08 09:01:31,404 DEBUG epollEventLoopGroup-2-5 - [id: 0x0982b1b4] FLUSH
2023-09-08 09:01:31,404 DEBUG epollEventLoopGroup-2-5 - [id: 0x0982b1b4] READ COMPLETE
2023-09-08 09:01:31,404 DEBUG epollEventLoopGroup-2-5 - [id: 0x0982b1b4] READ: 20B
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 03 00 00 10 0c 00 00 00 00 00 06 00 04 00 00 00 |................|
|00000010| 06 00 00 00 |.... |
+--------+-------------------------------------------------+----------------+
2023-09-08 09:01:31,404 INFO epollEventLoopGroup-2-5 - request info :org.apache.apisix.plugin.runner.HttpRequest@69b6119a
2023-09-08 09:01:31,404 DEBUG epollEventLoopGroup-2-5 - [id: 0x0982b1b4] WRITE: 24B
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 02 00 00 14 0c 00 00 00 00 00 06 00 08 00 04 00 |................|
|00000010| 06 00 00 00 03 00 00 01 |........ |
+--------+-------------------------------------------------+----------------+
2023-09-08 09:01:31,404 DEBUG epollEventLoopGroup-2-5 - [id: 0x0982b1b4] FLUSH
2023-09-08 09:01:31,405 DEBUG epollEventLoopGroup-2-5 - [id: 0x0982b1b4] READ COMPLETE