Why is my upload to an external server failing with a connection error during a build?

Last updated: August 21, 2026

Context

When running a script during a Codemagic build to upload artifacts (such as an app binary) to an external server, the upload may fail with an HTTP 499 "Client Closed Request" error or a similar connection-dropped error, even though the build itself is still running.

Answer

This type of error is not caused by Codemagic. Codemagic does not impose a timeout on individual build script steps — only an overall build timeout exists, and your build would need to reach that limit for it to apply.

An HTTP 499 error indicates that the connection was dropped on the receiving server's side, typically by a reverse proxy in front of your external server. Here are the most common causes and steps to investigate:

  1. Check your request headers. If you are manually setting a Transfer-Encoding: chunked header alongside a curl -T command, remove it. curl -T already sets Content-Length automatically, and combining it with chunked encoding is commonly rejected by reverse proxies.

  2. Check your server configuration. Review the reverse proxy or web server logs on your external server to understand why it is dropping the connection. Increasing the max execution time on the application level alone may not be sufficient if the reverse proxy has its own timeout settings.

  3. Test the upload locally. Download the build artifact from Codemagic and run the same upload command locally to verify whether the issue is specific to the server configuration rather than the upload script itself.

  4. Whitelist Codemagic IP addresses. If your server has brute-force protection or IP allowlisting enabled, make sure the following Codemagic build machine IP addresses are allowed:

    • 34.74.234.56/32

    • 35.185.76.207/32

    • 38.22.7.112/29

    • 66.185.17.80/29

    • 66.185.18.0/29

    • 162.253.134.16/29

    • 207.254.42.240/29

    You can also find the full and up-to-date list of Codemagic IP addresses in the Codemagic documentation.