# App connection timeout

**URL:** <https://community.fly.io/t/app-connection-timeout/5369>\
**Category:** Questions / Help\
**Created:** [May 27, 2022, 7:56pm UTC](https://community.fly.io/t/app-connection-timeout/5369 "2022-05-27T19:56:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanertopal](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tanertopal](https://community.fly.io/u/tanertopal)\
**Post date:** [May 27, 2022, 7:56pm UTC](https://community.fly.io/t/app-connection-timeout/5369/1 "2022-05-27T19:56:50Z")

</div>

```auto
2022-05-27T18:11:00Z app[7c712c82] fra [info]INFO: 145.40.94.27:38344 - "OPTIONS /api/predict HTTP/1.1" 200 OK
error.message="App connection idle" 2022-05-27T18:57:27Z proxy[7c712c82] fra [warn]error.code=2004 request.method="POST"
 request.url="https://api.ml.lexai.co/predict" request.id="01G43BC2PXPGW3GQMDS252S8XP-fra" response.status=502

```

I am getting this error on a long running connection. The server is receiving the POST request but needs 3min to 5min before answering. Can I do something about it?

---

<div class="post-metadata">

**Author:** ![jerome](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jerome/32/17_2.png) [@jerome](https://community.fly.io/u/jerome)\
**Post date:** [May 27, 2022, 8:11pm UTC](https://community.fly.io/t/app-connection-timeout/5369/2 "2022-05-27T20:11:50Z")

</div>

We close connections after 60s of inactivity.

You have a few options:

- You can change your app’s behaviour to send back a `Accepted` status code (or something like that) and then poll for the result later on, in a loop, from your client.
- You can keep sending data (like a ping) to keep the connection from being considered idle.
- Longer idle timeouts will be available via upcoming paid plans.
