OnGoingLzy commented on issue #11200: URL: https://github.com/apache/apisix/issues/11200#issuecomment-2078889869
> Hi, Can you please provide the reproducing steps? ok Step 1: Set up two routes and two upstreams in the dashboard. Associate route A with upstream A, and route B with upstream B. Route B is used for forwarding requests to an external authentication service (i.e., upstream B). Step 2: Enable the forward-auth plugin for route A and set the URI to http://localhost:9080/authApi/api/authorization/authorization1 (Note: authApi is the path of route B, which means that when calling the external authentication, it should go through route B). Step 3: Once the routes and upstreams are set up, test a POST request to the interface corresponding to upstream A through route A at http://localhost:9080/userCenterApi/api/GetToken/GetData (Note: userCenterApi is the path of route A, which means that accessing this path will make apisix forward the request). Outcome: The external authentication service successfully validates, and during debugging, it was noticed that the request body content can be read normally. I use the following code to read the request body: using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) { body = await reader.ReadToEndAsync(); // Do something with the body... } After successful external validation, when the request is forwarded by route A to upstream A, upstream A is unable to read the request body. I use the following code to read the request body: using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8)) { body = await reader.ReadToEndAsync(); // Do something with the body... } The reason for not being able to read is due to the occurrence of an exception, Microsoft.AspNetCore.Connections.ConnectionResetException, with the message: "The client has disconnected." Subsequently, the apisix log shows: "upstream timed out (110: Connection timed out) while reading response header from upstream." Once I commented out the code for reading the request body, the exception did not occur, and there was no 504 timeout.  As a beginner, I am unable to identify the root cause of this error. Your assistance in resolving this issue would be greatly appreciated. Thank you! -- 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]
