janiussyafiq commented on issue #11587:
URL: https://github.com/apache/apisix/issues/11587#issuecomment-4196804266

   Hi @bpasson , there's a potential workaround for this issue without any code 
changes. Simply put this in your config would get your desired result:
   1. Set up route with proxy-rewrite plugin:
   ```bash
   curl -X PUT 'http://127.0.0.1:9180/apisix/admin/routes/1'   -H 'X-API-KEY: 
<admin_key>' -H 'Content-Type: application/json'   -d '{
       "uri": "/anything",
       "plugins": {
         "proxy-rewrite": {
           "headers": {
             "set": {
               "foo": "bar2,bar3"
             }
           }
         }
       },
       "upstream": {
         "type": "roundrobin",
         "nodes": { "httpbin.org:80": 1 }
       }
     }'
   ```
   2. Send a request `curl -X GET -H 'foo: bar1' 
'http://127.0.0.1:9080/anything'`
   3. Result:
   ```bash
   {
     "args": {}, 
     "data": "", 
     "files": {}, 
     "form": {}, 
     "headers": {
       "Accept": "*/*", 
       "Foo": "bar2,bar3", 
       "Host": "127.0.0.1", 
       "User-Agent": "curl/7.81.0", 
       "X-Amzn-Trace-Id": <redacted>, 
       "X-Forwarded-Host": "127.0.0.1:9080"
     }, 
     "json": null, 
     "method": "GET", 
     "origin": "127.0.0.1, <redacted>", 
     "url": "http://127.0.0.1:9080/anything";
   }
   Let me know if this solution works for your case, thanks!


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