mikyll commented on issue #12334:
URL: https://github.com/apache/apisix/issues/12334#issuecomment-2980256584

   I tested a slightly changed version and it seem to be working...
   
   ```bash
   curl "localhost:9180/apisix/admin/routes/1" -X PUT -d '
   {
     "uri": "/attach/*",
     "name": "cbs-bj-prod-route-attach",
     "desc": "cbs-bj-prod-attach",
     "host": "xxx.gadf.com",
     "plugins": {
       "file-logger": {
         "include_req_body": false,
         "include_resp_body": false,
         "path": "/data/apisix/logs/xxxx.logaccess.log"
       },
       "proxy-rewrite": {
         "uri": "/get",
         "headers": {
           "Host": "$host",
           "X-Forwarded-For": "$proxy_add_x_forwarded_for",
           "X-Real-IP": "$remote_addr",
           "http_version": "1.1"
         }
       }
     },
     "upstream": {
       "nodes": {
         "httpbin.org:80": 1
       }
     },
     "status": 1
   }
   '
   ```
   
   I changed the upstream to point to echo service httpbin and added a URI 
rewrite (to `/get` API) in proxy-rewrite.
   
   Request:
   
   ```bash
   curl localhost:9080/attach/test -H "Host: xxx.gadf.com"
   {
     "args": {}, 
     "headers": {
       "Accept": "*/*", 
       "Host": "xxx.gadf.com", 
       "Http-Version": "1.1", 
       "User-Agent": "curl/8.5.0", 
       "X-Amzn-Trace-Id": "Root=1-685163c6-6e2941160707a6d54bea3004", 
       "X-Forwarded-Host": "xxx.gadf.com"
     }, 
     "origin": "10.89.3.12, X.X.X.X", 
     "url": "http://xxx.gadf.com/get";
   }
   ```
   
   Logs:
   
   ```lang-none
   [apisix]  | 10.89.3.12 - - [17/Jun/2025:12:47:00 +0000] localhost:9180 "PUT 
/apisix/admin/routes/1 HTTP/1.1" 200 662 0.008 "-" "curl/8.5.0" - - - 
"http://localhost:9180";
   [apisix]  | 10.89.3.12 - - [17/Jun/2025:12:47:04 +0000] xxx.gadf.com "GET 
/attach/test HTTP/1.1" 200 336 2.085 "-" "curl/8.5.0" X.X.X.X:80 200 2.061 
"http://xxx.gadf.com/get";
   ```


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