bzp2010 commented on code in PR #12243: URL: https://github.com/apache/apisix/pull/12243#discussion_r2117628008
########## t/plugin/loki-logger.t: ########## @@ -80,6 +82,7 @@ done "loki-logger": { "endpoint_addrs": ["http://127.0.0.1:3100"], "tenant_id": "tenant_1", + "authorization": "Bearer 1234", Review Comment: Then, please do this: 1. Create route with the following upstream and URI ```text === TEST XX: setup route (test auth headers) --- config location /t { content_by_lua_block { local t = require("lib.test_admin").test local code, body = t('/apisix/admin/routes/1', ngx.HTTP_PUT, [[{ "plugins": { "loki-logger": { "endpoint_addrs": ["http://127.0.0.1:1980"], "endpoint_uri": "/log_request", "request_headers": {"Authorization": "test1234"}, "batch_max_size": 1 } }, "upstream": { "nodes": { "127.0.0.1:1980": 1 }, "type": "roundrobin" }, "uri": "/hello" }]] ) if code >= 300 then ngx.status = code end ngx.say(body) } } --- response_body passed ``` 2. Send a request to `/hello` endpoint to trigger the log, then check the error.log. ```text === TEST XX+1: hit route --- request GET /hello --- response_body hello world --- error_log go(): authorization: test1234 ``` The /log_request endpoint used by loki will log the following error.log.  It contains every request header, which obviously includes the one we configured for loki for authentication. -- 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: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org