The Somewhat Subtler Solution

Because we don't want to cripple all network connections to get a single site to work (albeit an important one), we cannot turn off TCP Window Scaling on all our Linux machines. But there is a trick to force the window scale to 1 (2^0), as described in thread 1193579 on the <praise>Ubuntu forums</praise>:

jurjen@testhost:~$ MYDEFAULTROUTE=
      jurjen@testhost:~$ SERVERIP=
      jurjen@testhost:~$ sudo ip route add $SERVERIP via $MYDEFAULTROUTE window 65535

After this (and after getting over that pesky third-reload timeout of the site), the pages load as fast as with tcp windows scaling turned off at the system level. But other connections can still be as fast as ever.

Now we need to get this re-routing thing to work every time the host boots, so we create an upstart job /etc/init/lwp-twsc-reroute.conf to run when the interfaces come up:

# lwp-twsc-reroute
description "Add choked static route to tcp-window-scaling-challenged IPs"

start on net-device-up IFACE=eth*

author "Jurjen Bokma <>"


env DEFAULTFILE=/etc/default/lwp-twsc-reroute

DEFROUTE=$(route -n|grep '^0\.0\.0\.0'|awk '{print $2}')
if [ -n "${DEFROUTE}" ] ;then
    for LINE in $(grep -v '^[\t\ ]*#' ${DEFAULTFILE}) ; do
        if echo ${LINE}|grep -q [a-zA-Z] ; then # a hostname
            IP=$(host -tA ${LINE}|egrep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') || continue
            IP=${LINE} # IP may or may not have a netmask
        logger "Adding throttled route to ${HOST} to fix its window scaling problems"
        ip route add ${IP} via ${DEFROUTE} window 65535 || true
exit 0
end script

That does the trick if you provide it a list of hostnames in /etc/default/lwp-twsc-reroute:

# This file should contain a list of places that traffic should be routed to
# over a connection so throttled that tcp window scale is zero
# Lines may be of the forms
# FQDN, e.g.
# IP, e.g.
# IP/masklength, e.g.

The script can be run with

user@testbox:~$ sudo start lwp-twsc-reroute
lwp-reroute-tws-challenged stop/waiting

... the the route can be removed with:

user@testbox:~$ sudo route del

I had to create a package anyway, I might as well put it online: lwp-twsc-reroute_0.0.2-0ubuntu1_amd64.deb (and no, I don't have a public repository to put it in, but you can have the source package if you contact me).