Getting timeout on proxy/rewrite requests

I’m proxying requests to an API server and some requests take quite long. They seem to timeout after 28 seconds and I’m receiving a 500 status code.

I could not find anything in the Netlify docs about this. Also I checked if it was the API server giving the timeout, but directly requesting the API server did not result in a timeout.

Is there any way I can increase this timeout?

Hi Demian,

That timeout cannot be changed. Our system intends to proxy to endpoints that return web content to interactive browsers, and if your web content hasn’t shown up in 26 seconds, it is unlikely that the people in the browser are still waiting. If you’re proxying to trigger something like a long running batch job, I’d be using an asynchronous call rather than proxying.

If your endpoint STARTS sending before 26 seconds (say, HTTP response headers) and the data comes shortly after, that may still work. Aim to have the operation completed in under 60 seconds even then, though.

We’ll add this caveat to the docs, thanks for bringing it up!

1 Like

Just ran into this myself and spent a day trying to figure out if there was a real error in my application somewhere. Thanks for getting the docs updated :pray:t4:

1 Like

I just wanted to note that this 26 second timeout and the suggested workaround of using an asynchronous request is now covered in our docs under Rewrites & proxies > limitations. Thanks everyone for this conversation that led to a docs improvement!

Hi. What exactly do you mean by asynchronous call? Making a request with one call and then polling for status? Or something else?

I think the best definition would be Amazon’s :slight_smile: