Git Product home page Git Product logo

Comments (5)

nitishfy avatar nitishfy commented on September 21, 2024

Hi, Can you please provide the reproducing steps?

from apisix.

OnGoingLzy avatar OnGoingLzy commented on September 21, 2024

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.

image

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!

from apisix.

kayx23 avatar kayx23 commented on September 21, 2024

I am also running into the 504 timeout error with the following log:

*3516 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.21.0.1, server: _, request: "POST /anything HTTP/1.1", upstream: "http://174.129.50.9:80/anything", host: "127.0.0.1:9080"

It is unclear how to correctly use the "request_method": "POST" option without invoking this error. I am changing very minimal config from the doc example and will be easier to reproduce.

Details:

image

image

image

Things run well without "request_method": "POST" in the plugin config.

from apisix.

kayx23 avatar kayx23 commented on September 21, 2024

Related: #11050, from the convo it looks like 3.6.0 does not have this issue. To be tested.

from apisix.

OnGoingLzy avatar OnGoingLzy commented on September 21, 2024

Related: #11050, from the convo it looks like 3.6.0 does not have this issue. To be tested.相关: #11050 ,从 convo 来看,3.6.0 没有这个问题。待测试。

Thanks for the reply, I'll try it in version 3.6.0

from apisix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.