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

   ### Current Behavior
   
   When using the following configuration intended to at /api to the beginning 
of the path:
   
   plugin_configs:
     -
       id: prefix_api
       plugins:
         proxy-rewrite:
           uri: /api$request_uri
   
   The ? indicating the start of the query string is converted to %253F causing 
the upstream GET to fail with a 404.  The log entry below demonstrates this 
issue.
   
   192.168.200.6 - - [14/Jan/2025:16:37:31 +0000] api.example.com "GET 
/uuid?id=1 HTTP/1.1" 404 156 0.005 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; 
x64; rv:135.0) Gecko/20100101 Firefox/135.0" 192.168.200.7:1880 404 0.005 
"http://upstream:1880/api/uuid%253Fid=1?id=1";
   
   ### Expected Behavior
   
   It is expected that the ? indicating the start of the query string should be 
preserved as per the example mock up log entry below.
   
   192.168.200.6 - - [14/Jan/2025:16:37:31 +0000] api.example.com "GET 
/uuid?id=1 HTTP/1.1" 404 156 0.005 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; 
x64; rv:135.0) Gecko/20100101 Firefox/135.0" 192.168.200.7:1880 200 0.005 
"http://upstream:1880/api/uuid?id=1?id=1";
   
   ### Error Logs
   
   192.168.200.6 - - [14/Jan/2025:16:37:31 +0000] api.example.com "GET 
/uuid?id=1 HTTP/1.1" 404 156 0.005 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; 
x64; rv:135.0) Gecko/20100101 Firefox/135.0" 192.168.200.7:1880 404 0.005 
"http://upstream:1880/api/uuid%253Fid=1?id=1";
   
   ### Steps to Reproduce
   
   Configure a proxy-rewrite as per below and attempt to access a configured 
route adding a query string such as ?id=1 to the url and observe the access 
logs.
   
   plugin_configs:
     -
       id: prefix_api
       plugins:
         proxy-rewrite:
           uri: /api$request_uri
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.11.0 Docker Container
   - Operating system (run `uname -a`): Ubuntu 22.04
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): 
   
   nginx version: openresty/1.25.3.2
   built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
   built with OpenSSL 3.2.0 23 Nov 2023
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 
-DAPISIX_RUNTIME_VER=1.2.1 -DNGX_LUA_ABORT_AT_PANIC 
-I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include 
-I/usr/local/openresty/openssl3/include' --add-module=../ngx_devel_kit-0.3.3 
--add-module=../echo-nginx-module-0.63 --add-module=../xss-nginx-module-0.06 
--add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.33 
--add-module=../form-input-nginx-module-0.12 
--add-module=../encrypted-session-nginx-module-0.09 
--add-module=../srcache-nginx-module-0.33 --add-module=../ngx_lua-0.10.26 
--add-module=../ngx_lua_upstream-0.07 
--add-module=../headers-more-nginx-module-0.37 
--add-module=../array-var-nginx-module-0.06 
--add-module=../memc-nginx-module-0.20 --add-module=../redis2-nginx-module-0.15 
--add-module=../redis-nginx-module-0.3.9 --add-module=../ngx_stream_lua-0.0.14 
--with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib 
-Wl,-rpath,/usr/local/openresty/wasmtime-c-api/li
 b -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib 
-L/usr/local/openresty/openssl3/lib 
-Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl3/lib'
 --add-module=/tmp/tmp.0vt0zLPiwq/openresty-1.25.3.2/../mod_dubbo-1.0.2 
--add-module=/tmp/tmp.0vt0zLPiwq/openresty-1.25.3.2/../ngx_multi_upstream_module-1.2.0
 
--add-module=/tmp/tmp.0vt0zLPiwq/openresty-1.25.3.2/../apisix-nginx-module-1.16.1
 
--add-module=/tmp/tmp.0vt0zLPiwq/openresty-1.25.3.2/../apisix-nginx-module-1.16.1/src/stream
 
--add-module=/tmp/tmp.0vt0zLPiwq/openresty-1.25.3.2/../apisix-nginx-module-1.16.1/src/meta
 --add-module=/tmp/tmp.0vt0zLPiwq/openresty-1.25.3.2/../wasm-nginx-module-0.7.0 
--add-module=/tmp/tmp.0vt0zLPiwq/openresty-1.25.3.2/../lua-var-nginx-module-v0.5.3
 --add-module=/tmp/tmp.0vt0zLPiwq/openresty-1.25.3.2/../lua-resty-events-0.2.0 
--with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module 
--with-stream_ssl_preread_module --with-http_v2_mod
 ule --with-http_v3_module --without-mail_pop3_module 
--without-mail_imap_module --without-mail_smtp_module 
--with-http_stub_status_module --with-http_realip_module 
--with-http_addition_module --with-http_auth_request_module 
--with-http_secure_link_module --with-http_random_index_module 
--with-http_gzip_static_module --with-http_sub_module --with-http_dav_module 
--with-http_flv_module --with-http_mp4_module --with-http_gunzip_module 
--with-threads --with-compat --with-stream --without-pcre2 
--with-http_ssl_module
   
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`): N/A Using standalone deployment
   - APISIX Dashboard version, if relevant: N/A Using standalone deployment
   - Plugin runner version, for issues related to plugin runners: proxy-rewrite
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


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