tzssangglass opened a new issue #6095: URL: https://github.com/apache/apisix/issues/6095
### Issue description When I tested APISIX, I found that under special conditions apisix would give me mirror-related errors even if I did not use the proxy mirror plugin. ### Environment - apisix version (cmd: `apisix version`):master - OS (cmd: `uname -a`):macos /centos7.9 - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`): ``` nginx version: openresty/1.19.9.1 built by clang 12.0.5 (clang-1205.0.22.11) built with OpenSSL 1.1.1l 24 Aug 2021 TLS SNI support enabled configure arguments: --prefix=/usr/local/Cellar/openresty-debug/nginx --with-debug --with-cc-opt='-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -O2 -DAPISIX_BASE_VER=0.0.0 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/Cellar/zlib/1.2.11/include -I/usr/local/Cellar/pcre/8.45/include -I/usr/local/Cellar/openresty-openssl111/1.1.1l_1/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.20 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.10 --with-ld-opt= '-Wl,-rpath,/usr/local/Cellar/openresty-debug/luajit/lib -Wl,-rpath,/usr/local/Cellar/openresty-debug/wasmtime-c-api/lib -L/usr/local/Cellar/zlib/1.2.11/lib -L/usr/local/Cellar/pcre/8.45/lib -L/usr/local/Cellar/openresty-openssl111/1.1.1l_1/lib -Wl,-rpath,/usr/local/Cellar/zlib/1.2.11/lib:/usr/local/Cellar/pcre/8.45/lib:/usr/local/Cellar/openresty-openssl111/1.1.1l_1/lib' --add-module=/private/var/folders/d2/kfkndm417kv5mmlgvk1_xb8r0000gn/T/tmp.6Uimr4Zn/openresty-1.19.9.1/../mod_dubbo --add-module=/private/var/folders/d2/kfkndm417kv5mmlgvk1_xb8r0000gn/T/tmp.6Uimr4Zn/openresty-1.19.9.1/../ngx_multi_upstream_module --add-module=/private/var/folders/d2/kfkndm417kv5mmlgvk1_xb8r0000gn/T/tmp.6Uimr4Zn/openresty-1.19.9.1/../apisix-nginx-module --add-module=/private/var/folders/d2/kfkndm417kv5mmlgvk1_xb8r0000gn/T/tmp.6Uimr4Zn/openresty-1.19.9.1/../apisix-nginx-module/src/stream --add-module=/private/var/folders/d2/kfkndm417kv5mmlgvk1_xb8r0000gn/T/tmp.6Uimr4Zn/openresty-1.19.9.1/../wasm-nginx -module --add-module=/private/var/folders/d2/kfkndm417kv5mmlgvk1_xb8r0000gn/T/tmp.6Uimr4Zn/openresty-1.19.9.1/../lua-var-nginx-module --with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_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 --with-http_ssl_module ``` - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API): `etcd Version: 3.5.0` - apisix-dashboard version, if have: - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner): - luarocks version, if the issue is about installation (cmd: `luarocks --version`): `luarocks 3.7.0` ### Steps to reproduce 1. set `config.yaml` as ```yaml apisix: admin_key: - name: admin key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please update it when you deploy to production environment role: admin nginx_config: http: enable_access_log: false ``` 2. add prometheus plugin to global_rule ``` curl -i http://127.0.0.1:9080/apisix/admin/global_rules/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "plugins": { "prometheus": {} } }' ``` 3. add route ``` curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "upstream": { "nodes": { "127.0.0.1:1980": 1 }, "type": "roundrobin" }, "uri": "/hello" }' ``` 4. test routs ``` curl http://127.0.0.1:9080/hello ``` ### Actual result The request is proxied correctly, but there is an error reported in `logs/error.log` . ### Error log ``` 2022/01/14 10:55:14 [error] 50660#29698657: *971 invalid URL prefix in "/hello", client: 127.0.0.1, server: _, request: "GET /hello HTTP/1.1", subrequest: "/proxy_mirror", host: "127.0.0.1:9080" ``` ### Expected result It shouldn't be reporting this error because I don't have the proxy-mirror plugin enabled. When I disable proxy-mirror in `config.yaml`, the error does not exist. I was unable to reproduce the test case with the following test case and it looks like there is a difference between the test case and the runtime. ``` use t::APISIX 'no_plan'; repeat_each(1); no_long_string(); no_root_location(); add_block_preprocessor(sub { my ($block) = @_; if (!$block->request) { $block->set_value("request", "GET /t"); } if ((!defined $block->error_log) && (!defined $block->no_error_log)) { $block->set_value("no_error_log", "[error]"); } }); run_tests; __DATA__ === TEST 1: set global rules --- yaml_config apisix: node_listen: 1984 admin_key: null nginx_config: http: enable_access_log: false --- config location /t { content_by_lua_block { local t = require("lib.test_admin").test local code, body = t('/apisix/admin/global_rules/1', ngx.HTTP_PUT, [[{ "plugins": { "prometheus": {} } }]] ) if code >= 300 then ngx.status = code ngx.say(body) return end code, body = t('/apisix/admin/routes/1', ngx.HTTP_PUT, [[{ "uri": "/hello", "upstream": { "nodes": { "127.0.0.1:1980": 1 }, "type": "roundrobin" } }]] ) if code >= 300 then ngx.status = code ngx.say(body) return end -- wait for sync ngx.sleep(0.6) local http = require "resty.http" local httpc = http.new() local uri = "http://127.0.0.1:" .. ngx.var.server_port .. "/hello" local res, err = httpc:request_uri(uri, {method = "GET"}) if not res then ngx.say(err) return end ngx.say("passed") } } --- wait: 1 --- response_body passed ``` I will be tracking this bug. -- 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]
