Reputation: 127
I am using nginx as a proxy and I wonder how I can adjust the maximum size of the mss size in nginx configuration. I have not found any related configuration option yet. Any ideas?
Upvotes: 0
Views: 3778
Reputation: 8138
I think you're referring to the TCP_MAXSEG TCP option in Linux - which sets the maximum segment size for outgoing TCP packets. There was a patch submitted to the Nginx mail list to add that functionality but it seems that it didn't get accepted. So the only way to effectively limit the MSS is by setting the MTU on the network interface that Nginx is attached. This works because the MSS is always less than the interface MTU. But this will affect all processes bound to that interface. e.g To change eth0 MTU to 1492:
sudo ip link set eth0 mtu 1492
As you mention in your comment the Nginx postpone_output
option does relate to the MSS - as in it should be set the MSS - though it defaults to 1460 (which a common MSS for IPv4, though not for IPv6). But as mentioned in the comments by @Ron the MSS can not be directly set at the application level as it is negotiated at the TCP level per connection (so it can change) - this is either by performed through Path MTU discovery or more often these days by MSS clamping (where a network entity alters the MSS TCP option in the TCP header of the SYN and SYNACK packets).
Upvotes: 2