# Nginx mss patch

**URL:** <https://www.ruby-forum.com/t/nginx-mss-patch/208053>\
**Category:** NGINX\
**Created:** [June 9, 2011, 6:06am UTC](https://www.ruby-forum.com/t/nginx-mss-patch/208053 "2011-06-09T06:06:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [June 9, 2011, 6:06am UTC](https://www.ruby-forum.com/t/nginx-mss-patch/208053/1 "2011-06-09T06:06:45Z")

</div>

hi all,  
we made some changes to nginx in order to support tcp mss which is  
already  
supported by haproxy. you can see the attached patch for details. it is  
a  
patch against version 0.8.54.

the configuration is very easy.  
server {  
listen 80 mss=1440;  
}

---

<div class="post-metadata">

**Author:** ![Ning\_Wang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b19c9b/32.png) [@Ning\_Wang](https://www.ruby-forum.com/u/Ning_Wang)\
**Post date:** [June 9, 2011, 7:10am UTC](https://www.ruby-forum.com/t/nginx-mss-patch/208053/2 "2011-06-09T07:10:14Z")

</div>

Hi,

Just out of curiosity, could you please provide some context, i.e. in  
what  
circumstance do you have to change the TCP MSS or the benefit? After  
all,  
there’re TCP path MTU discovery mechanisms already.

As for the patch itself, I don’t think it’s a good idea to set the  
default  
value of mss to 1024, since it will punish those who don’t want this  
feature. BTW, the TCP\_MAXSEG option is not supported by all OS vendors,  
so  
you should test it first (in auto/os/features).

P.S. It seems that the diff format of your patch is wrong.

Regards,  
Joshua

---

<div class="post-metadata">

**Author:** ![Ning\_Wang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b19c9b/32.png) [@Ning\_Wang](https://www.ruby-forum.com/u/Ning_Wang)\
**Post date:** [June 9, 2011, 9:05am UTC](https://www.ruby-forum.com/t/nginx-mss-patch/208053/3 "2011-06-09T09:05:39Z")

</div>

MTU discovery mechanisms does not work very well for ADSL users with  
PPPoE  
link, especially when they use wireless home router. client users may  
failed  
to upload picture or music or any other big post requests. here is a  
post  
regarding to this problem.  
[http://hi.baidu.com/ybbmdf/blog/item/287d878b498e04d6fc1f1079.html](http://hi.baidu.com/ybbmdf/blog/item/287d878b498e04d6fc1f1079.html)( i am  
sorry it is in Chinese). so we have to decrease the tcp package size.

BTW, thanks for your advice for the patch, its very nice.

---

<div class="post-metadata">

**Author:** ![Ning\_Wang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b19c9b/32.png) [@Ning\_Wang](https://www.ruby-forum.com/u/Ning_Wang)\
**Post date:** [June 9, 2011, 9:21am UTC](https://www.ruby-forum.com/t/nginx-mss-patch/208053/4 "2011-06-09T09:21:06Z")

</div>

On Thu, Jun 09, 2011 at 01:10:00PM +0800, Joshua Z. wrote:

> Hi,
> 
> Just out of curiosity, could you please provide some context, i.e. in what  
> circumstance do you have to change the TCP MSS or the benefit? After all,  
> there’re TCP path MTU discovery mechanisms already.
> 
> As for the patch itself, I don’t think it’s a good idea to set the default  
> value of mss to 1024, since it will punish those who don’t want this  
> feature. BTW, the TCP\_MAXSEG option is not supported by all OS vendors, so  
> you should test it first (in auto/os/features).

Yes, the default TCP\_MAXSEG value should not be set, and  
should be handled like rcvbuf or sndbuf option.

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![Ning\_Wang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b19c9b/32.png) [@Ning\_Wang](https://www.ruby-forum.com/u/Ning_Wang)\
**Post date:** [June 18, 2011, 6:34pm UTC](https://www.ruby-forum.com/t/nginx-mss-patch/208053/5 "2011-06-18T18:34:53Z")

</div>

some wireless home router’s mtu parameter was not set up correctly, and  
we  
have to use this patch to indicate end users to send a smaller package.  
However this feature does not function below kernel version 2.6.28.

---

<div class="post-metadata">

**Author:** ![Ning\_Wang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b19c9b/32.png) [@Ning\_Wang](https://www.ruby-forum.com/u/Ning_Wang)\
**Post date:** [June 13, 2011, 10:44am UTC](https://www.ruby-forum.com/t/nginx-mss-patch/208053/6 "2011-06-13T10:44:31Z")

</div>

the new mss patch. TCP\_MAXSEG value is not set by default.

the previous one was generated using git diff, hopefully the format is  
right  
this time.
