zhlu001 commented on issue #219:
URL: 
https://github.com/apache/apisix-java-plugin-runner/issues/219#issuecomment-1341875833

   Hi,
   
   We use spring boot  as receiver with ***@***.***”.
   Besides, we tested response.setheader(), somehow, it works. But we do not 
know why.
   
   Thx.
   
   Best regards,
   
   Zhanpeng LU
   
   Business Analytics Asia Pacific (CI/PDD2)
   Bosch (China) Investment Ltd. | 333 Fuquan (N.) Road | Shanghai 200335 | 
P.R. CHINA
   ***@***.******@***.***>
   ​
   From: tzssangglass ***@***.***>
   Sent: Thursday, December 8, 2022 10:06
   To: apache/apisix-java-plugin-runner ***@***.***>
   Cc: LU Zhanpeng (CI/PDD2) ***@***.***>; Author ***@***.***>
   Subject: Re: [apache/apisix-java-plugin-runner] help request: How to dynamic 
add/remove headers in "ext-plugin" with Java Runner (Issue #219)
   
   
   I can't reproduce your problem.
   
   filter:
   
   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:
   
   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:
   
   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
   
   —
   Reply to this email directly, view it on 
GitHub<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fapisix-java-plugin-runner%2Fissues%2F219%23issuecomment-1341872721&data=05%7C01%7Czhanpeng.lu%40cn.bosch.com%7C8269ea59b61d41a1da4a08dad8c0b373%7C0ae51e1907c84e4bbb6d648ee58410f4%7C0%7C0%7C638060619398523548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=2FwWEBMdVOGYp0A38czGP6DxQNMES3S0aoNF%2BngYUdo%3D&reserved=0>,
 or 
unsubscribe<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARTFJ6ZIUWTWPDGFTBJJY23WME67BANCNFSM6AAAAAASWZ2MKQ&data=05%7C01%7Czhanpeng.lu%40cn.bosch.com%7C8269ea59b61d41a1da4a08dad8c0b373%7C0ae51e1907c84e4bbb6d648ee58410f4%7C0%7C0%7C638060619398523548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=js%2FscMNX3FvzNjLIESv6JuJkt6WfGyyabSbmBiHN
 qnY%3D&reserved=0>.
   You are receiving this because you authored the thread.Message ID: 
***@***.******@***.***>>
   


-- 
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]

Reply via email to