# Timeout when posting large file data to external API using a proxy (rewrite)

**URL:** <https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387>\
**Category:** Support\
**Tags:** create-react-app, redirects\
**Created:** [July 23, 2021, 3:48pm UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387 "2021-07-23T15:48:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Woodley](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/tom_woodley/32/22912_2.png) [@Tom\_Woodley](https://answers.netlify.com/u/Tom_Woodley)\
**Post date:** [July 23, 2021, 3:48pm UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387/1 "2021-07-23T15:48:16Z")

</div>

Hello

First time poster here hoping to get a hand!

I’ve have an CRA site that gets data and posts data to a REST API outside of netlify. Some of the data being posted to the API can be pretty big (sometime over 1gb). I’ve used the rewrites file to create a proxy, so the site can connect to the API. This works great, but if a post request isn’t completed within about 30 seconds, it fails and I get a net::ERR\_HTTP2\_PROTOCOL\_ERROR in the console.

I’m guessing there’s a timeout limit somewhere, but could anyone point me in the right direction as to where I can update it. Or is this something that can’t be done?

I know there is some limitations around large media and timeouts on netlify functions, but as the data is only being proxied through netlify, I’m hoping there’s a way to change this limit.

File uploads work without restrictions (well, not any that I’ve hit) when using the app locally, so I think the issue is related to netilfy.

Any help/guidance would be awesome

Thanks

Tom

---

<div class="post-metadata">

**Author:** ![coelmay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/coelmay/32/24427_2.png) [@coelmay](https://answers.netlify.com/u/coelmay)\
**Post date:** [July 24, 2021, 12:27am UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387/2 "2021-07-24T00:27:49Z")

</div>

Welcome to the forums @Tom_Woodley

If I read/understand correctly, you have a proxy such as

```auto
/api https://example.com/api

```

which you are using to upload a file to from your site. Might I assume you are using a form, possibly a serverless function, to handle this? Function have a [10 second execution limit](https://docs.netlify.com/functions/overview/#default-deployment-options) and 15min for background functions. If you are using a form, there is a [30 second timeout](https://docs.netlify.com/forms/setup/#limitations) on file uploads which correlates with what you are seeing.

---

<div class="post-metadata">

**Author:** ![Tom\_Woodley](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/tom_woodley/32/22912_2.png) [@Tom\_Woodley](https://answers.netlify.com/u/Tom_Woodley)\
**Post date:** [July 26, 2021, 7:01am UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387/3 "2021-07-26T07:01:02Z")

</div>

Thanks @coelmay that’s exactly right. I’m using a form input to allow users to add files, which get’s uploaded on submit via an ajax api route. Normally 30 seconds would be ample, but as we’re working with large file data, it can often exceed this.

Is there any way to circumvent this?

Many thanks for your help!

Tom

---

<div class="post-metadata">

**Author:** ![coelmay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/coelmay/32/24427_2.png) [@coelmay](https://answers.netlify.com/u/coelmay)\
**Post date:** [July 26, 2021, 7:27am UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387/4 "2021-07-26T07:27:20Z")

</div>

The only circumvention I can think of is not using a proxy. I don’t believe the system was designed for such uses.

Others may have more to add than that.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 26, 2021, 10:38am UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387/5 "2021-07-26T10:38:18Z")

</div>

Hi @Tom_Woodley,

You’re right. There’s a 30 sec connection limit for a proxy and the connection should close within that limit. There’s no way to increase this unfortunately. So, what you’re trying might not be possible.

---

<div class="post-metadata">

**Author:** ![harrygr](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/harrygr/32/28693_2.png) [@harrygr](https://answers.netlify.com/u/harrygr)\
**Post date:** [August 24, 2021, 1:25pm UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387/6 "2021-08-24T13:25:27Z")

</div>

I’m having the same issue with my Netlify-hosted frontend. Requests to my backend are proxied using a Netlify rewrite rule in the style [described here](https://docs.netlify.com/routing/redirects/rewrites-proxies/#proxy-to-another-service). This is great as I don’t have to deal with CORS and cookies _just work_ with “SameSite: strict”.

I have a simple file upload form that allow users to upload images. The upload is performed in a graphql multipart request.

The files concerned are usually only 5-10MB (I have a 10MB limit per upload) in size but on slower connections this can easily hit the 26s timeout. Is there no way at all to raise it? Even upping it to ~1 minute would allow a much greater share of file uploads to succeed.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [August 24, 2021, 1:43pm UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387/7 "2021-08-24T13:43:26Z")

</div>

Hi @harrygr,

Sorry to bear bad news, but that’s one of the hard limits that can’t/won’t change at least for the time being.

I think the best bet for you would be to add a client-side timer to let the know they have only this much time to upload and it will fail - this is far from ideal, I agree but it’s either this or no proxy at all.

---

<div class="post-metadata">

**Author:** ![harrygr](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/harrygr/32/28693_2.png) [@harrygr](https://answers.netlify.com/u/harrygr)\
**Post date:** [August 24, 2021, 1:46pm UTC](https://answers.netlify.com/t/timeout-when-posting-large-file-data-to-external-api-using-a-proxy-rewrite/41387/8 "2021-08-24T13:46:10Z")

</div>

That’s a shame. The proxy is a really useful feature for apis. I think the answer might have to be to stop using it.
