# Keep-alive and Safari

**URL:** <https://www.ruby-forum.com/t/keep-alive-and-safari/199381>\
**Category:** NGINX\
**Created:** [November 19, 2010, 8:40pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381 "2010-11-19T20:40:46Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [November 19, 2010, 8:40pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/1 "2010-11-19T20:40:46Z")

</div>

As I understand from reading the mail list, keep-alive is not enabled  
for Safari browsers.  
We really would like to enable this (for at least iPhone/iPad  
clients)…

Questions:

- Is keep-alive disabled for all Safari/Web kit browsers?
- Can this be configured, to allow keep-alive even for Safari?

Whe are using nginx 0.8.53

/Jan Andersson

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 25, 2010, 1:30pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/2 "2010-11-25T13:30:59Z")

</div>

Hello!

On Thu, Nov 25, 2010 at 07:04:45AM -0500, doors wrote:

> I also founded NGIX disabled keep-alive for safari.
> 
> I am not sure exact reason of this.

> **[Safari intermittently hangs when loading FCGI request](http://mailman.nginx.org/pipermail/nginx/2010-October/023131.html)**

Maxim D.

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 25, 2010, 1:05pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/3 "2010-11-25T13:05:50Z")

</div>

I also founded NGIX disabled keep-alive for safari.

I am not sure exact reason of this.

### ngx\_http\_core\_module.c

if (r-\>keepalive) {

```
        if (r->headers_in.msie6) {
            if (r->method == NGX_HTTP_POST) {
                /*
                 * MSIE may wait for some time if an response for
                 * a POST request was sent over a keepalive

```

connection  
\*/  
r-\>keepalive = 0;  
}

```
        } else if (r->headers_in.safari) {
            /*
             * Safari may send a POST request to a closed keepalive
             * connection and stalls for some time
             */
            r->keepalive = 0;
        }
    }

```

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,151962,153237#msg-153237](http://forum.nginx.org/read.php?2,151962,153237#msg-153237)

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 25, 2010, 4:50pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/4 "2010-11-25T16:50:52Z")

</div>

Hi,  
regading:

> > I also founded NGIX disabled keep-alive for safari.
> > 
> > I am not sure exact reason of this.
> 
> [Safari intermittently hangs when loading FCGI request](http://nginx.org/pipermail/nginx/2010-October/023131.html)

I still beleive it would be great if there was an option to enable  
keep-alive for Safari.  
Not all sites need this work-a-round…

/Jan

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 25, 2010, 5:14pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/5 "2010-11-25T17:14:07Z")

</div>

On Thu, Nov 25, 2010 at 07:09:31PM +0300, Igor S. wrote:

> > I still beleive it would be great if there was an option to enable keep-alive  
> > for Safari.  
> > Not all sites need this work-a-round…
> 
> The attached patch introduces  
> safari\_keepalive on|off;  
> directive. The default value is “off”.  
> It will be included in next 0.9.0.

It can be set on http, server, or location level.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 25, 2010, 5:10pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/6 "2010-11-25T17:10:21Z")

</div>

On Thu, Nov 25, 2010 at 04:49:52PM +0100, Jan Andersson wrote:

> Not all sites need this work-a-round…  
> The attached patch introduces  
> safari\_keepalive on|off;  
> directive. The default value is “off”.  
> It will be included in next 0.9.0.

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 25, 2010, 5:32pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/7 "2010-11-25T17:32:56Z")

</div>

Hello!

On Thu, Nov 25, 2010 at 07:09:31PM +0300, Igor S. wrote:

> > I still beleive it would be great if there was an option to enable keep-alive  
> > for Safari.  
> > Not all sites need this work-a-round…
> 
> The attached patch introduces  
> safari\_keepalive on|off;  
> directive. The default value is “off”.  
> It will be included in next 0.9.0.

I would like to see something more general, e.g.

keepalive\_disable safari msie6;  
keepalive\_disable off;

This should be helpfull for servers without POST’s at all, and  
looks much more extendable.

Should I prepare a patch?

Maxim D.

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 25, 2010, 7:19pm UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/8 "2010-11-25T19:19:38Z")

</div>

On Thu, Nov 25, 2010 at 07:32:05PM +0300, Maxim D. wrote:

> > > > >
> > 
> > It will be included in next 0.9.0.
> 
> I would like to see something more general, e.g.
> 
> keepalive\_disable safari msie6;  
> keepalive\_disable off;
> 
> This should be helpfull for servers without POST’s at all, and  
> looks much more extendable.

You are right. The attached patch introduces  
keepalive\_disable safari msie6; # default  
keepalive\_disable none; # turn off

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 26, 2010, 1:17am UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/9 "2010-11-26T01:17:59Z")

</div>

It’s great.

thanks for prompt response.

/YM

Posted at Nginx Forum:

> **[Re: Keep-alive and Safari](https://forum.nginx.org/read.php?2,151962,153385#msg-153385)**
>
> As I understand from reading the mail list, keep-alive is not enabled for Safari browsers. We really would like to enable this (for at least iPhone/iPad clients)... Questions: - Is keep-alive disabled for all Safari/Web kit browsers? - Can this be...

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 26, 2010, 6:54am UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/10 "2010-11-26T06:54:57Z")

</div>

On Thu, Nov 25, 2010 at 08:23:04PM -0500, doors wrote:

> Is patch for 0.8.53 ?

Yes.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 26, 2010, 2:24am UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/11 "2010-11-26T02:24:23Z")

</div>

Is patch for 0.8.53 ?

Posted at Nginx Forum:

> **[Re: Keep-alive and Safari](https://forum.nginx.org/read.php?2,151962,153392#msg-153392)**
>
> As I understand from reading the mail list, keep-alive is not enabled for Safari browsers. We really would like to enable this (for at least iPhone/iPad clients)... Questions: - Is keep-alive disabled for all Safari/Web kit browsers? - Can this be...

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 26, 2010, 6:58am UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/12 "2010-11-26T06:58:05Z")

</div>

Hi

Is it also suitable for 0.7.x and 0.6.x ?

-----ʼԭ-----  
: Igor S. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
ʱ: 20101126 13:53  
ռ: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
: Re: Keep-alive and Safari

On Thu, Nov 25, 2010 at 08:23:04PM -0500, doors wrote:

> Is patch for 0.8.53 ?

Yes.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

* * *

nginx mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> **[mailman.nginx.org archive](http://mailman.nginx.org/pipermail/)**

This e-mail is confidential. It may also be legally privileged.If you  
are not the addressee you may not copy, forward, disclose or use any  
part of it. If you have received this message in error,please delete it  
and all copies from your system and notify the sender immediately by  
return e-mail.Internet communications cannot be guaranteed to be  
timely,secure, error or virus-free. The sender does not accept liability  
for any errors or omissions.

---

<div class="post-metadata">

**Author:** ![Jan\_Andersson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@Jan\_Andersson](https://www.ruby-forum.com/u/Jan_Andersson)\
**Post date:** [November 26, 2010, 7:13am UTC](https://www.ruby-forum.com/t/keep-alive-and-safari/199381/13 "2010-11-26T07:13:43Z")

</div>

On Fri, Nov 26, 2010 at 01:54:16PM +0800, Zhang,Tony wrote:

> Hi
> 
> Is it also suitable for 0.7.x and 0.6.x ?

It’s not suitable for 0.7.x.  
0.6.x does not disable keepalive for Safari.

> On Thu, Nov 25, 2010 at 08:23:04PM -0500, doors wrote:
> 
> > Is patch for 0.8.53 ?
> 
> Yes.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
