Issue with Kong Causing Loop and No Response for Django Project API

Hi Kong Admin,

In my Django project, I’ve implemented a GET users API endpoint that returns data in the following structure:


{
    "status": <status_code>,
    "data": <data>
}

When there is no data available, the response is designed to return a 204 status code with an empty data array, as shown below:


{
    "status": 204,
    "data": []
}

The API endpoint is accessible directly at:

http://localhost:8010/users/list

I’ve configured a service in Kong with the following details:

-Upstream URL: http://localhost:8010/users/list

Additionally, I’ve set up a route for the above service with the path:

/users/list

However, when I try to access the API through Kong using the endpoint:

http://localhost:8000/users/list

I encounter an issue. Instead of receiving the expected 204 response when there’s no data in the users table, I’m getting no response at all. After some time, the API request seems to go into a loop and eventually gets aborted.

Could you please assist me in resolving this issue with Kong’s configuration? I’ve ensured that the API works as expected when accessed directly, but there seems to be an issue when going through Kong.

Thank you for your attention to this matter. I look forward to your guidance and assistance.