keilon opened a new issue, #12623:
URL: https://github.com/apache/apisix/issues/12623

   ### Current Behavior
   
   Using the proxy-rewrite plugin to modify the request uri, if 
`use_real_request_uri_unsafe` is set to `true`, the queryS tring of original 
request will be discarded. And returned to normal when 
`use_real_request_uri_unsafe`  is set to `false`(default), 
   
   ### Expected Behavior
   
   Whether or not `use_real_request_uri_unsafe` is enabled, the queryString 
should not be discarded.
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1. Add route with proxy-rewrite plugin:
   ```
   curl -XPUT -H "x-api-key:${ADMIN_KEY}" 
http://localhost:9180/admin/apisix/routes \
   -d '{
       "id": "httpbin-get",
       "methods": ["GET"],
       "uri": "/fakeget",
       "plugins": {
         "proxy-rewrite": {
           "uri": "/get",
           "use_real_request_uri_unsafe": true
         }
       },
       "upstream": {
         "type": "roundrobin",
         "pass_host": "node",
         "nodes": {
           "httpbin.org:80": 1
         }
       }
     }'
   ```
   2. Send httpbin GET request with query param `curl -XGET 
"localhost:9080/fakeget?foo=bar"`
   
   <img width="810" height="278" alt="Image" 
src="https://github.com/user-attachments/assets/37a7cf57-3323-4157-af20-8863bf983adf";
 />
   
   3. Update proxy-rewrite plugin setting:
   ```
   curl -XPUT -H "x-api-key:${ADMIN_KEY}" 
http://localhost:9180/admin/apisix/routes \
   -d '{
       "id": "httpbin-get",
       "methods": ["GET"],
       "uri": "/fakeget",
       "plugins": {
         "proxy-rewrite": {
           "uri": "/get",
           "use_real_request_uri_unsafe": false
         }
       },
       "upstream": {
         "type": "roundrobin",
         "pass_host": "node",
         "nodes": {
           "httpbin.org:80": 1
         }
       }
     }'
   ```
   4. Send the same request `curl -XGET "localhost:9080/fakeget?foo=bar"`
   
   <img width="848" height="329" alt="Image" 
src="https://github.com/user-attachments/assets/44e73b9d-1ef9-4c78-9c65-9b5a47ddc110";
 />
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.13.0
   - Operating system (run `uname -a`): Debian GNU/Linux 11
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): 
openresty/1.27.1.2
   


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