# Disabling HTTP keepalive by User-Agent

**URL:** <https://www.ruby-forum.com/t/disabling-http-keepalive-by-user-agent/182261>\
**Category:** NGINX\
**Created:** [January 25, 2010, 6:51pm UTC](https://www.ruby-forum.com/t/disabling-http-keepalive-by-user-agent/182261 "2010-01-25T18:51:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshua](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@joshua](https://www.ruby-forum.com/u/joshua)\
**Post date:** [January 25, 2010, 6:51pm UTC](https://www.ruby-forum.com/t/disabling-http-keepalive-by-user-agent/182261/1 "2010-01-25T18:51:31Z")

</div>

A long-standing bug in Safari causes file uploads to hang when keepalive  
connections are improperly reused.

[https://bugs.webkit.org/show\_bug.cgi?id=5760](https://bugs.webkit.org/show_bug.cgi?id=5760)

In Apache, disabling keepalive support for Webkit solves this problem.

Is there a way to do this with nginx?

- Joshua

Posted at Nginx Forum:

> **[disabling HTTP keepalive by User-Agent](https://forum.nginx.org/read.php?2,45489,45489#msg-45489)**
>
> A long-standing bug in Safari causes file uploads to hang when keepalive connections are improperly reused. https://bugs.webkit.org/show\_bug.cgi?id=5760 In Apache, disabling keepalive support for Webkit solves this problem. Is there a way to do this...

---

<div class="post-metadata">

**Author:** ![joshua](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@joshua](https://www.ruby-forum.com/u/joshua)\
**Post date:** [January 26, 2010, 2:58am UTC](https://www.ruby-forum.com/t/disabling-http-keepalive-by-user-agent/182261/2 "2010-01-26T02:58:35Z")

</div>

On Tue, Jan 26, 2010 at 1:50 AM, joshua [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> In Apache, disabling keepalive support for Webkit solves this problem.
> 
> Is there a way to do this with nginx?

How about turning off r-\>keepalive in an early request processing  
phase (like the rewrite phase) for those webkit user agents? I think a  
little C module will do that trick 😉

Cheers,  
-agentzh

---

<div class="post-metadata">

**Author:** ![joshua](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@joshua](https://www.ruby-forum.com/u/joshua)\
**Post date:** [January 26, 2010, 4:08pm UTC](https://www.ruby-forum.com/t/disabling-http-keepalive-by-user-agent/182261/3 "2010-01-26T16:08:48Z")

</div>

On Mon, Jan 25, 2010 at 12:50:43PM -0500, joshua wrote:

> A long-standing bug in Safari causes file uploads to hang when keepalive connections are improperly reused.
> 
> [5760 – Safari hangs when uploading files to certain php scripts](https://bugs.webkit.org/show_bug.cgi?id=5760)
> 
> In Apache, disabling keepalive support for Webkit solves this problem.
> 
> Is there a way to do this with nginx?

The patch.
