[GCP](EN) Case of modifying timeout for 504 status code in GKE Ingress

Case of modifying timeout for 504 status code in GKE Ingress


Environment and Prerequisite

  • GKE


Background

  • During E2E test, the code for API requests was executed but the status code returned 504


Solution and Steps

504 status code means that server like gateway or proxy did not get a response in time from upstream server. Normally called with “Gateway Timeout”.

Simply say, requests were forwarded to a server behind but returns 504 status code because of exceeding timeout period.

Below is explanation from MDN Web Docs.

The HyperText Transfer Protocol (HTTP) 504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request.

I examined the endpoint of the API which is GKE Ingress that I used, to see if there are any points where timeouts are configured.

I could trace the path through the GCP console’s Ingress as follows:

ingress => load balancer => backend services

There was a timeout setting in one of “Backend services” which I call API.

After modifying that timeout, api call timeout changed to longer. Also receive 202 status code instead of 504 status code.


Reference