I have a compute engine VM instance with a docker image. It has a server that does expensive computations that take around 2 minutes for each request.

The server responds perfectly for small requests. For larger ones it responds with the following:

<HEAD><TITLE>Connection Timed Out</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black">
<FONT FACE="Helvetica,Arial"><B>
 Connection Timed Out</B></FONT>

<!-- default "Connection Timed Out" response (504) -->

The server in my docker container does not return this.

Looking at what 504 errors mean:

The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.

Note: Note to implementors: some deployed proxies are known to return 400 or 500 when DNS lookups time out.

That clearly shows that compute engine has a proxy that times out after 30 seconds and gives the above response.

Looking at the stackdriver logs I see that my server does receive the request and does process it, but before it's finished, I get the response above instead.

How do I stop compute engine from intervening with my server logic? Or at least how do I increase the timeout limit?

  • Could you provide more information: 1. What's machine type of your VM? 2. Why requests take up to 2 min? 3. Did you configure your web server to keep sessions for up to 2 min? 4. Why do you think that compute engine "intervening" "server logic"? Feb 13, 2020 at 16:08
  • I edited my question. 1) n1-standard-2. 2) It does expensive computations. 3) Yes. I wrote the server. 4) It's a 504 response that my server does not return. Feb 13, 2020 at 16:48
  • Please provide configuration of your web server that makes it able to keep your clients waiting up to 2 minutes while your server does computing. Also, it'll be useful to know architecture of your service. As you can find in the documentation GCE doesn't use any proxies by default. Feb 13, 2020 at 18:58

1 Answer 1


The issue was solved by using port 8080, any port other than 80 would work.

For some reason GCE would not intervene with your affairs if you don't use port 80.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.